Saturday, May 5, 2018

Mythrecmaze - Automatically Record the Shows You Follow on TVmaze

Instead of or in addition to setting a recording using MythTV, follow your shows on tvmaze.com to have MythTV automatically record them.  A free or paid account on tvmaze.com is required.  The program checks the ical feed for the next seven days.  It then downloads guide data for the current day each time it is run and the next six days only if there is a change in the ical feed for those days.  It supports multiple API keys, so everyone in the house can have their own TVmaze account.

Automatically Record the Shows You Follow on TVmaze Using MythTV

Notes:
  1. Changing the MythTV xmltvid values is not required.  Mythrecmaze is compatible with other guide sources if the guide entries inserted from Mythrecmaze matching the recordings are not overwritten by the other guide source.
  2. TVmaze is not limited to the USA, but this program currently works in the USA only.
  3. Mythrecmaze has been tested using Ubuntu and Xubuntu.  The latest release has been tested with MythTV versions 31 and 32.
Setup:
  1. Navigate to https://github.com/heyted/mythrecmaze/releases.
  2. Under the latest release, download the tar.gz file and put it in your home folder.
  3. Open a terminal and copy or type "tar -xzf mythrecmaze-20201004.tar.gz && cd mythrecmaze-20201004 && sudo ./install" without the quotes.  Edit the release numbers to match the tar.gz file name if they do not match and press enter.  The message "Mythrecmaze was successfully installed" should appear in the terminal.
  4. The tar.gz file and mythrecmaze-20201004 folder can be deleted.
  5. Do the tasks as indicated below for guide source option one or two.  Use option one if you have no other guide data source other than using Mythrecmaze.  Use option two if another guide data source is being used.
  6. Start Mythrecmaze by viewing the applications menu and clicking on the Mythrecmaze icon.
  7. Select Change settings and click OK.
  8. Enter the MythTV backend IP address and other information requested.  To access your TVmaze API key, log into TVmaze, hover the cursor over the user icon at the top-right of the web page, and click dashboard.
  9. Select Exit Mythrecmaze and click OK.
  10. Open a terminal and type or copy "sudo crontab -u mythtv -e" without the quotes.  If prompted to choose an editor, nano is a good choice.  Enter "30 14 * * * /opt/mythrecmaze/mythrecmaze.py" without the quotes at the bottom of the text file to have Mythrecmaze check for new recordings every day at 2:30 PM.  Hold Ctrl and press s to save the change.  Hold Ctrl and press x to exit nano.  
  11. Check that the mythtv group has read access to /home/[yourusername].  On Ubuntu, open Files, browse to /home, right click on the folder for your user name, click properties, permissions, and verify the mythtv group or others can access the files.
Guide Source Option One:
  1. Open a web browser and navigate to [backend ip address]/mythweb/settings/tv/channels. 
  2. Edit the xmltvid values in the channel information section to match the corresponding TVmaze id values.  TVmaze network id numbers are shown at the bottom of this blog post.  
Guide Source Option Two:
  1. Create a text file named “xmltvidmap.csv” which will match your xmltvid values with the corresponding TVmaze id values. If xmltvidmap.csv does not exist, option one must be used. If it does exist, option two must be used.  An example xmltvidmap.csv is available at https://github.com/heyted/mythrecmaze.  TVmaze network id numbers are shown at the bottom of this blog post.  
  2. Check that xmltvidmap.csv is readable by the mythtv user by right clicking on file, click properties, and click permissions.  Select read only for the mythtv group or others.
  3. Place xmltvidmap.csv in your home folder.
  4. Each line in the text file must have two entries separated by a comma. Do not include any blank lines between the entries. The first entry must match the current MythTV xmltvid value (not necessarily a number) and correspond to the TVmaze id number as the second entry.
TVmaze channel ID numbers and corresponding channel names:

ID
Channel Name
1NBC
2CBS
3ABC
4FOX
5The CW
8HBO
9Showtime
10Adult Swim
11Cartoon Network
13FX
14TNT
15BBC America
16Syfy
17Starz
18Lifetime
19Cinemax
20AMC
21El Rey Network
22MTV
23Comedy Central
25Disney XD
26FreeForm
27Nickelodeon
28WGN America
29A&E
30USA Network
31Audience Network
32TBS
33Sundance TV
34Paramount Network
39ESPN
40CNN
42National Geographic Channel
43E!
47FXX
50Hallmark Channel
52Bravo
53History
55VH1
56BET
57TV Land
58Centric
62nick@nite
65IFC
66Discovery Channel
70UPN
71The WB
72Syndication
73Nicktoons
74H2
75REELZ
77Science
78Disney Channel
79Oxygen
80TLC
81Food Network
82Travel Channel
83National Geographic WILD
84truTV
85PBS
86Smithsonian Channel
88Pop
89Investigation Discovery
90DIY Network
92Animal Planet
93CNBC
95Fox Sports 1
101TeenNick
103Great American Country
104NBCSN
107Destination America
117Logo TV
122We tv
125fyi,
138Pay-Per-View
142MotorTrend
145MTV2
169Al Jazeera America
170AXS TV
171Big Ten Network
172Bloomberg TV
173CMT
174Cooking Channel
175Create
176Discovery Family
177Discovery Life
178Encore
179ASPiRE
180ESPN2
181ESPNEWS
182ESPNU
183ESPN Deportes
184Esquire Network
185FOX News Channel
186FUSE TV
187Fusion
188Golf Channel
189Game Show Network
190HBO Family
191HBO Signature
192HGTV
193HLN
194ION Television
195ION Life
196Live Well Network
197The Longhorn Network
198Me-TV
199MLB Network
200MoreMax
201MSNBC
203MyNetworkTV
204NBA TV
205NFL Network
206Nick Jr.
207Outdoor Channel
208Ovation
210PAC-12 Network
211Pivot
212Qubo
213RFD-TV
214SEC Network
215Showtime 2
216Showtime Extreme
217Sportsman Channel
218Turner Classic Movies
219Telemundo
220Tennis Channel
221The Movie Channel
222The Movie Channel Xtra
223Toon Disney
224TV One
225UniMás
226Univision
227UP TV
228The Weather Channel
229AHC
232Lifetime Movies
233LrW
236Oprah Winfrey Network
248G4
252Hallmark Movies and Mysteries
253Epix
254Starz Edge
255Starz Cinema
256Starz Comedy
257Starz InBlack
258Starz Kids and Family
260Showtime Women
261BOUNCE TV
272CBS Sports Network
284Speed TV
319Style TV
340Current TV
342Universal Kids
354The Family Channel
357ESPN Classic
378FM
386Fox Sports 2
395PBS SoCal
396Chiller
430World
455TV Guide Channel
456Boomerang
466Fearnet
467BYU Television
488TCM
507EVINE Live
515Fox Soccer
516NHL Network
520REVOLT
524Fox Business Network
525Lionsgate Television
535Estrella TV
540PBS Kids
555CNBC World
557VH1 Classic
660insp
712NBC Universo
719Biography Channel
733Pursuit Channel
734Universal Sports Network
735Universal HD
736Palladia
739MAVTV
741MSG
749DuMont Television Network
757MASN
758TBN
975KCET
987Fox Family
988Here TV
993RLTV
1006Viceland
1007MHz Worldview
1009C-SPAN
1035Playboy TV
1039Disney Junior
1047Fox Sports SUN
1061Fox Reality Channel
1085Bandamax
1089WGBH-TV
1233NuvoTV
1275MTV Classic
1296National Educational Television
1310Home Shopping Network
1311EWTN
1313MTV Live
1318AWE
1321Light TV
1330Z Living
1336NESN
1337NESN Plus
1339American Sports Network
1368Ora TV
1380Soapnet
1383KCLV Channel 2
1434Mojo HD
1457Fox Kids
1464Mnet America
1485Myx TV
1492SHOWTIME Showcase
1509Prime Time Entertainment
1511Bohbot Kids Network
1513Christian Broadcasting Network
1514C-SPAN2
1532Mega TV
1594Escape
1603KLAS-TV
1620Spectrum
1626JTV
16573net
1661Trio
1680Connecticut Public Television
1690Cinelatino
1697  Hallmark Drama

3 comments:

  1. Updates:

    Added show episode title (subtitle) to EPG data
    Added show categories to EPG data
    Added compatibility with MythTV's new TVmaze metadata lookup
    Changed urls from http to https
    Fixed bug which could cause crash if script ran manually after running automatically

    New release: https://github.com/heyted/mythrecmaze/releases/tag/20210530

    ReplyDelete
  2. Trying on fedora 28 and get Enter another TVmaze API key or press enter if done -->
    Traceback (most recent call last):
    File "./install", line 86, in
    with open(homepath + '/.mythrecmaze/mythrecmaze.cfg', 'w') as configfile:
    FileNotFoundError: [Errno 2] No such file or directory: '/home/mythtv/.mythrecmaze/mythrecmaze.cfg'

    [root@localhost mythrecmaze-master]# pwd
    /home/mythtv/mythrecmaze-master

    I tried touch cfg as well, but get same error:
    ls /home/mythtv/.mythtvrecmaze/ -ll
    total 0
    -rw-r--r--. 1 root root 0 Jun 17 09:37 mythrecmaze.cfg

    ReplyDelete
    Replies
    1. Thank you for the comment. I use Mythrecmaze on the latest LTS desktop version of Ubuntu, and I can try to provide support for that. If you find a work-around solution for Fedora 28, please post the solution here so others can benefit.

      Delete