Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions _kodi_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class KodiItems(object):


def __init__(self):

self.kodi_version = 17
pass

def create_entry_path(self):
self.cursor.execute("select coalesce(max(idPath),0) from path")
Expand Down
3 changes: 2 additions & 1 deletion _kodi_movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
class KodiMovies(KodiItems):


def __init__(self, cursor):
def __init__(self, cursor, kodi_version):
self.cursor = cursor
self.kodi_version = kodi_version

KodiItems.__init__(self)

Expand Down
6 changes: 3 additions & 3 deletions movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

class Movies():

def __init__(self, kodicursor, sources_cursor, pdialog=None):
def __init__(self, kodicursor, sources_cursor, kodi_version, pdialog=None):

self.kodicursor = kodicursor
self.kodi_db = _kodi_movies.KodiMovies(self.kodicursor)
self.kodi_version = kodi_version
self.kodi_db = _kodi_movies.KodiMovies(self.kodicursor, self.kodi_version)
self.sources_cursor = sources_cursor
self.source_db = Customdb_Functions(self.sources_cursor)
self.kodi_version = 17

def _get_func(self, item_type, action):

Expand Down
42 changes: 38 additions & 4 deletions pptv_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sqlite3
import requests

import os
from common import *
from movies import Movies

Expand Down Expand Up @@ -187,12 +187,46 @@ def setitem_remap(set_item):
}


def choose_path():
print '-' * 15 + " Kodi Database path choose " + '-' * 15
choose = raw_input('\nfound both xbmc and kodi path, choose xbmc(1) or kodi(2):')
if choose == '1':
path = get_xbmc_path("xbmc")
version = 13
elif choose == '2':
path = get_xbmc_path("kodi")
version = 17
else:
path = ""
version = 0
print path, version
return path, version


def get_xbmc_path(name):
path = ""
if name == "xbmc":
path = os.path.join(os.getenv('APPDATA'), "XBMC")
elif name == "kodi":
path = os.path.join(os.getenv('PROGRAMFILES'), "Kodi17", "portable_data")
if not os.path.exists(path):
path = path.replace("Program Files (x86)", "Program Files")
return path


if __name__ == "__main__":
with sqlite3.connect(KODI_DATABASE_PATH + "MyVideos107.db", 120) as kodi_conn,\
sqlite3.connect(KODI_DATABASE_PATH + "pptv.db", 120) as pp_conn:
kodi_path, kodi_version = choose_path()
if kodi_version == 17:
kodi_database_path = kodi_path + "\\userdata\\Database\\MyVideos107.db"
pptv_database_path = kodi_database_path.replace("MyVideos107", "pptv")
else:
kodi_database_path = kodi_path + "\\userdata\\Database\\MyVideos78.db"
pptv_database_path = kodi_database_path.replace("MyVideos78", "pptv")
with sqlite3.connect(kodi_database_path, 120) as kodi_conn,\
sqlite3.connect(pptv_database_path, 120) as pp_conn:
cursor = kodi_conn.cursor()
pptv_cursor = pp_conn.cursor()
mo = Movies(cursor, pptv_cursor)
mo = Movies(cursor, pptv_cursor, kodi_version)
pptv = PPTVClass()
try:
# mo.update_artist_artwork()
Expand Down