Hi
I've updated a scanner which was written for Enigma2 (linux satellite box) files to work with files recorded with DVBLink. The files are in the following format;
Emmerdale-1900_20160324-4-10030000-1458846000.ts
ShowName-AirTime-AirDate-ChannelNo-NotUsed-Notused.ts
This works fine apart from where there are two episodes aired on the same date (at different times) such as;
Emmerdale-2000_20160324-4-10030000-1458849600.ts
As you can see, this is two episodes of the programme "Emmerdale", one aired at 7pm and one at 8pm. Unfortunately, Plex is only passing the air date to TheTVDB (and if my understanding of the API is correct, there isn't a way to identify multiple episodes on the same day) but I'm hoping to be proved wrong.
This is my code snippet - hopefully somebody will know either what the fix is or tell me this is not possible;
if (file.endswith(".ts")):
# Remove path and extension
tsfile = os.path.basename(file)
tsfile = os.path.splitext(tsfile)[0]
# DVBLink files are named as follows - Programme_Name,Time_Date,ChannelNo,JunkData,MoreJunkData
(programme,time_date,channel,junk,morejunk) = tsfile.split('-',6)
(time,date) = time_date.split('_')
year = int(date[0:4])
month = int(date[4:6])
day = int(date[6:8])
hour = int(time[0:2])
minute = int(time[2:4])
d = datetime.datetime(year, month, day, hour, minute)
t = d.timetuple()
show = programme.replace('_',' ')
season = year
#episode = (hour,minute)
#title = channel+" - "+date[6:8]+"/"+date[4:6]+"/"+date[0:4]+" "+time[0:2]+":"+time[2:4]
title = show
print "adding tv show", (show), "season", (season),"title", (title), "year", (year)
tv_show = Media.Episode(show,season,title,year)
tv_show.released_at = "%4d-%02d-%02d %02d:%02d" % (year, month, day, hour, minute)
tv_show.parts.append(file)
mediaList.append(tv_show)