mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-11 13:53:37 +00:00
Global_DatabaseUpdate Quick Fix
At the request of some, I have modified the Global_DatabaseUpdate file to import the previous database's daily_schedule. NOTE: If you end up experiencing issues with your shows playing, this may be because your new database does not have the resources to play the listed shows. May be time to run -g at that point.
This commit is contained in:
@@ -27,11 +27,13 @@ for channel_dir in channel_dirs:
|
||||
# Step TWO: Go to each folder, export the following information
|
||||
# - Show title, lastEpisodeTitle
|
||||
# - Movie title, lastPlayedDate
|
||||
# - Daily schedule currently being executed
|
||||
os.chdir(channel_dir)
|
||||
|
||||
channel_dirA = os.path.dirname(os.path.abspath(__file__))
|
||||
db_path = os.path.join(channel_dirA, "pseudo-channel.db")
|
||||
print("+++++ Importing from " + db_path)
|
||||
|
||||
try:
|
||||
conn = sqlite3.connect(db_path)
|
||||
table = conn.cursor()
|
||||
@@ -42,6 +44,10 @@ for channel_dir in channel_dirs:
|
||||
lastMovie_export = table.execute('SELECT lastPlayedDate,title FROM movies').fetchall()
|
||||
lastMovie_export = list(lastMovie_export)
|
||||
|
||||
daily_schedule = table.execute('SELECT * FROM daily_schedule').fetchall()
|
||||
|
||||
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
except:
|
||||
@@ -68,6 +74,12 @@ for channel_dir in channel_dirs:
|
||||
sql = "UPDATE movies SET lastPlayedDate=? WHERE title=?"
|
||||
table.execute(sql,lastMovie_export[i])
|
||||
|
||||
for i in range(0,len(daily_schedule)):
|
||||
sql = "INSERT INTO daily_schedule(id,unix,mediaID,title,episodeNumber,seasonNumber,showTitle,duration,startTime,endTime,dayOfWeek,sectionType,plexMediaID,customSectionName) \
|
||||
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
|
||||
table.execute(sql,daily_schedule[i])
|
||||
|
||||
|
||||
# Step FIVE: Remove any media not in the directories set of commerical archives
|
||||
print("+++++ Trimming database at " + db_path)
|
||||
os.system('sudo python report_MediaFolders.py')
|
||||
@@ -103,5 +115,4 @@ for channel_dir in channel_dirs:
|
||||
|
||||
print("+++++ " + db_path + " complete! Going to next file")
|
||||
|
||||
|
||||
print("+++++ Global update COMPLETE")
|
||||
|
||||
Reference in New Issue
Block a user