database storage updates

This commit is contained in:
Moe Fwacky
2021-06-25 22:54:41 -07:00
committed by GitHub
parent 00ca1c8235
commit ad4e64e926
7 changed files with 32 additions and 13 deletions

View File

@@ -893,6 +893,7 @@ class PseudoChannel():
except:
pass
show_title = entry[3]
notes_data = "Rated " + str(next_episode[10]) + "</br>" + str(next_episode[12])
if next_episode != None:
customSectionName = next_episode[9]
episode = Episode(
@@ -913,6 +914,7 @@ class PseudoChannel():
next_episode[5], # episode_number
next_episode[6], # season_number
advance_episode, # advance_episode
notes_data #notes
)
self.MEDIA.append(episode)
else:
@@ -1327,6 +1329,7 @@ class PseudoChannel():
#get plex metadata
plex_movie = self.PLEX.fetchItem(the_movie[6])
last_data = ""
notes_data = ""
if str(entry[3]).lower() == "kevinbacon":
actors_list_old = actors_list
actors_list = {}
@@ -1340,10 +1343,12 @@ class PseudoChannel():
if actor_match == "":
actor_match = actor.tag
if actor_match != "":
last_data = actor_match + "," + last_movie
notes_data = "This movie derived from " + last_movie + " through " + actor_match + "\n"
else:
last_data = ""
notes_data = ""
last_movie = the_movie[3]
actors_data = the_movie[12].strip('][').split(',')
notes_data = notes_data + "Rated " + the_movie[8] + "</br>Starring: " + actors_data[0] + ", " + actors_data[1] + " and " + actors_data[2] + "</br>" + the_movie[10] + "</br>" + the_movie[14]
movie = Movie(
section, # section_type
the_movie[3], # title
@@ -1357,7 +1362,7 @@ class PseudoChannel():
the_movie[6], # plex id
the_movie[7], # custom lib name
media_id, # media_id
last_data # notes (for storing kevin bacon data)
notes_data # notes (for storing kevin bacon data)
)
self.MEDIA.append(movie)
else:

View File

@@ -29,7 +29,8 @@ class Commercial(Media):
overlap_max,
plex_media_id,
custom_section_name,
media_id
media_id,
notes
):
super(Commercial, self).__init__(
@@ -46,3 +47,4 @@ class Commercial(Media):
custom_section_name,
media_id
)
self.notes = notes

View File

@@ -36,7 +36,8 @@ class Episode(Media):
show_series_title,
episode_number,
season_number,
advance_episode
advance_episode,
notes
):
super(Episode, self).__init__(
@@ -58,3 +59,4 @@ class Episode(Media):
self.episode_number = episode_number
self.season_number = season_number
self.advance_episode = advance_episode
self.notes = notes

View File

@@ -124,7 +124,8 @@ class PseudoChannelCommercial():
"0", # overlap_max
random_commercial[5], # plex_media_id
random_commercial[6], # custom lib name
"3" #media_id
"3", #media_id,
None #notes
)
last_commercial = new_commercial
if new_commercial_end_time > curr_item_start_time:
@@ -169,7 +170,8 @@ class PseudoChannelCommercial():
"0", # overlap_max
random_final_comm[5], # plex_media_id
random_final_comm[6], # custom lib name
"3" #media_id
"3", #media_id
None #notes
)
commercial_list.append(final_commercial)
break

View File

@@ -359,7 +359,7 @@ class PseudoChannelDatabase():
#print(str("{}: {} - {}".format(media.start_time, media.title, media.custom_section_name)).encode('UTF-8'))
except:
print("ERROR: Not outputting media info due to ascii code issues.")
if media.media_id == 112:
if media.media_id != 3:
notes = media.notes
else:
notes = ""
@@ -368,7 +368,7 @@ class PseudoChannelDatabase():
else:
seriesTitle = ''
self.add_daily_schedule_to_db(
media.media_id if media.__class__.__name__ == "Movie" else 0,
media.media_id,
media.title,
media.episode_number if media.__class__.__name__ == "Episode" else 0,
media.season_number if media.__class__.__name__ == "Episode" else 0,

View File

@@ -145,10 +145,18 @@ for channel_dir in channel_dirs:
entryList['endTime'] = datetime.datetime.fromtimestamp(float(entryList['startTimeUnix']) + the_show[4]/1000).strftime("%H:%M:%S")
entryList['timeShift'] = 15
entryList['overlapMax'] = 15
entryList['xtra'] = ""
entryList['xtra'] = None
entryList['rerun'] = 0
entryList['year'] = None
entryList['genres'] = None
entryList['actors'] = None
entryList['collections'] = None
entryList['rating'] = None
entryList['studio'] = None
entryList['seasonEpisode'] = None
print("INFO: Adding "+entryList['startTime']+" - "+entryList['title']+"\033[K",end='\n')
sql = "INSERT INTO schedule(id,unix,mediaID,title,duration,startTime,endTime,dayOfWeek,startTimeUnix,section,strictTime,timeShift,overlapMax,xtra) \
VALUES(:id,:unix,:mediaID,:title,:duration,:startTime,:endTime,:dayOfWeek,:startTimeUnix,:section,:strictTime,:timeShift,:overlapMax,:xtra)"
sql = "INSERT INTO schedule(id,unix,mediaID,title,duration,startTime,endTime,dayOfWeek,startTimeUnix,section,strictTime,timeShift,overlapMax,xtra,rerun,year,genres,actors,collections,rating,studio,seasonEpisode) \
VALUES(:id,:unix,:mediaID,:title,:duration,:startTime,:endTime,:dayOfWeek,:startTimeUnix,:section,:strictTime,:timeShift,:overlapMax,:xtra,:genres,:actors,:collections,:rating,:studio,:seasonEpisode)"
table.execute(sql,entryList)
timediff = datetime.datetime.strptime("23:59:59", "%H:%M:%S") - datetime.datetime.strptime(entryList['startTime'], "%H:%M:%S")
print("INFO: "+str(timediff.seconds)+" to midnight\033[K",end='\n')

View File

@@ -440,7 +440,7 @@ def ps_update():
git.Repo.clone_from('https://github.com/FakeTV/pseudo-channel', '../temp', branch=ps_branch)
except Exception as e:
print("ERROR GETTING DOWNLOADING FROM GIT")
print("e")
print(e)
mainFiles = glob.glob('../temp/main-dir/*')
bothFiles = glob.glob('../temp/both-dir/*')
srcFiles = glob.glob('../temp/both-dir/src/*')