Page 1 of 1

Record defined Series/Episodes

Posted: Sat Jan 25, 2020 12:00 am
by cmal
...just as a preface: I don't want to high-jack this forum! But since it is important for me and I discovered a bug in a previously posted file (viewtopic.php?p=132906#p132906) I would like to correct this (unfortunately there is no "edit" of old posts available) :

Task:
how to record defined episodes of a series, like
record: = s02e05
record: < s03e10
record: > s05e00

the batch script should do this, now corrected for troubles of "octal" numbers having leading "0"...


- extract the txt, rename as "_Serie.bat" and copy into a Directory created within epg123 Directory (parallel to .../output; e.g. .../recreq); I have epg123 installed outside /program files... so; I'm not sure whether it will work "inside" (not tested)...

- you can change certain Default Settings:
+ directory for temporal files; default is "dr=", which means the files stay in the dir of the batch; I have directed them to my RAM-drive: "dr=x:\"
+ correction for UTC (0/1); normally not needed, so the default is "0";
+ create log-file; default is "1";
+ should Mediacenter (which is opened during the process) be closed at the end?; default is "1" (yes)

- the "_Serie.bat" has to be run as admin; I have set it up as a scheduled Task once a week (with 14 days of time line, this should be enough);

- basically this code performs a reverse Engineering on the "epg123.mxf" (it does not change it); on my small low power HTPC-machine the parsing takes ~1h (~50 Sat-channels);

- during the first run (do it manually; right-click as admin) the Batch will create a "_rec.ini" and stop; do not create the file any other way; read line 1+2 if the ini; don't delete them;

- you should now edit lines 3 and following (add lines as needed) with the series you want (it is possible to have the same series in more than one line, like "BLA = s05e03" and "BLA > s06e00")

- during the next run also a vbs file will be created which is needed

- there will be also for every series a "*_done.txt" created which contains the already recorded episodes; do not delete them

What this code does is to create a “*.c2r” file ("click to record") for each episode and inject it into Mediacenter; since that means Mediacenter incorporates the info on its own, the risk to destroy the database is minimized (but maybe not zero!); I tried to do it via recordings backup but obviously this fails because a critical ID of the channels in the .mxf is changing every day… kills the database…

Edit: ...corrected silly error with brackets in the _rec.ini creation step, sorry...

Re: Record defined Series/Episodes

Posted: Fri Apr 17, 2020 10:07 pm
by cmal
Update/Bugfix...

- I have realized that in situations where more channels are subscribed than actually mapped in the line-up, an episode could be found in the epg123.mxf, which is not represented in the actual epg channel line-up;
- in this version the available channels are (I hope correctly) retrieved from the latest Media Center backup of lineup, to avoid this error
- this time I turned to a 3rd Party script for some of the string manipulations; it is Dave Benham's JREPL.bat (version 8.5), which can be downloaded here (a very universal string manipulation tool):
https://www.dostips.com/forum/viewtopic ... 26887da131

- rename it to "_JREPL.bat" and place it into the same directory as "_Serie.bat"

Re: Record defined Series/Episodes

Posted: Sat May 16, 2020 4:02 pm
by cmal
corrected typo "qrem" (which produced some error messages) to "@rem"

Re: Record defined Series/Episodes

Posted: Sun Dec 20, 2020 9:18 pm
by cmal
I have converted this into an executable, which is faster (obviously) and does not need any additional third party tools;

- safe the exe in a path parallel to '\output'
- use "prefix Episode Description with episode number" in epg123.exe;
- during the first run an ini-filed is created; read and configure as needed;
- it is assumed that s02e05 = S2:E5; in the ini both notation can be used; in the done files only the first is used;
- if you setup a 'sheduled Task', define also the path 'execute in', otherwise the relative path might not work

hope it works!

Re: Record defined Series/Episodes

Posted: Sat Jan 02, 2021 8:09 pm
by cmal
an update (hopefully the last):
it provides the additional option to move the recordings to a selected destination (like the NAS: move=\\MyNAS\Series);
it will create a separate subfolder under the 'move-path' for each series and move the recording while renaming it to 'episode-number_episode-title.wtv' (e.g.: s01_e04_If the Stars Should Appear.wtv);
moving means: it is deleted afterwards in the 'Recorded TV'-folder; so, be careful and test first...
the 'moving' is only done if a series in the ini is marked with 'm', the move directory is defined and the 'RecordPath' can be extracted from Registry;
warning: if you have already many recordings of a 'to be moved' series, the copying might take a while! you can kill the process; the file in-process will stay intact; c2r will restart next time with the last file;

important: check 'add episode number to description' in epg123.exe; and perform a database backup in the epg123Client.exe with your latest setup, otherwise the channels-lineup might not be correct;
do not check 'add episode number to title' otherwise you will get the episode number twice in the moved filename;
(if you re-create the ini, you will get the description in there; just copy-paste the series-info from your old ini into the new);

good luck!

PS: execute as admin

Re: Record defined Series/Episodes

Posted: Sun Jan 03, 2021 10:21 am
by IT Troll
This is not something I have ever needed to do, but hopefully others will find it useful.
Thanks for the contribution and for sharing.

Re: Record defined Series/Episodes

Posted: Sat Feb 13, 2021 11:18 pm
by cmal
bug-fix in date creation