mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2026-01-06 18:23:15 +00:00
Fix for the -i (import shows) logic. Updated SQL command to UPDATE and existing rows with only lastEpisodeTitle
This commit is contained in:
@@ -660,12 +660,12 @@ class PseudoChannel():
|
||||
def import_queue(self):
|
||||
|
||||
"""Dropping previous shows table before adding the imported data"""
|
||||
self.db.clear_shows_table()
|
||||
#self.db.clear_shows_table()
|
||||
with open('pseudo-queue.json') as data_file:
|
||||
data = json.load(data_file)
|
||||
#pprint(data)
|
||||
#print(data)
|
||||
for row in data:
|
||||
print row
|
||||
print "lastEpisodeTitle:", row[5]
|
||||
self.db.import_shows_table_by_row(
|
||||
row[2],
|
||||
row[3],
|
||||
@@ -693,7 +693,7 @@ class PseudoChannel():
|
||||
data = json.load(data_file)
|
||||
#pprint(data)
|
||||
for row in data:
|
||||
print row
|
||||
"""print row"""
|
||||
self.db.import_daily_schedule_table_by_row(
|
||||
row[2],
|
||||
row[3],
|
||||
|
||||
@@ -332,22 +332,7 @@ class PseudoChannelDatabase():
|
||||
|
||||
unix = int(time.time())
|
||||
try:
|
||||
self.cursor.execute('''REPLACE INTO shows
|
||||
(unix,
|
||||
mediaID,
|
||||
title,
|
||||
duration,
|
||||
lastEpisodeTitle,
|
||||
fullImageURL,
|
||||
plexMediaID
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)''',
|
||||
(unix,
|
||||
mediaID,
|
||||
title,
|
||||
duration,
|
||||
lastEpisodeTitle,
|
||||
fullImageURL,
|
||||
plexMediaID))
|
||||
self.cursor.execute('UPDATE shows SET lastEpisodeTitle = ? WHERE title = ?', (lastEpisodeTitle, title))
|
||||
self.conn.commit()
|
||||
# Catch the exception
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user