Release RNE Podcasts add-on for KODI
#16
Hi Jamontes,

till this morning "Radio en directo" is not working, i can't see it in the menu. I think the web page www.rtve.es/radio/podcast has changed. I've made some changes to rne_api.py and now is working, here are the modifications:

def get_create_index():
"""This function gets the the first level index menu."""

main_url = root_url + '/tsacdop/oidar/'[::-1]

menu_patterns = (
( 'program_list', '<a href="([^"]*?)" title="(Listado de programas)"><span>'),
)

buffer_url = l.carga_web(main_url)
menu_entries = get_two_level_menu(buffer_url)

for action, pattern in menu_patterns:
url, title = l.find_first(buffer_url, pattern) or ('', '')
if url:
menu_item = {
'action' : action,
'title' : get_clean_title(title),
'args' : url,
}
menu_entries.append(menu_item)

menu_item = {
'action' : 'menu_direct',
'title' : 'Radio en directo',
'args' : '',
}
menu_entries.append(menu_item)

return menu_entries

Now i can hear radio3.

Thanks.
Reply
#17
(2016-02-13, 20:30)vicglez Wrote: Hi Jamontes,

till this morning "Radio en directo" is not working, i can't see it in the menu. I think the web page www.rtve.es/radio/podcast has changed. I've made some changes to rne_api.py and now is working, here are the modifications:

def get_create_index():
"""This function gets the the first level index menu."""

main_url = root_url + '/tsacdop/oidar/'[::-1]

menu_patterns = (
( 'program_list', '<a href="([^"]*?)" title="(Listado de programas)"><span>'),
)

buffer_url = l.carga_web(main_url)
menu_entries = get_two_level_menu(buffer_url)

for action, pattern in menu_patterns:
url, title = l.find_first(buffer_url, pattern) or ('', '')
if url:
menu_item = {
'action' : action,
'title' : get_clean_title(title),
'args' : url,
}
menu_entries.append(menu_item)

menu_item = {
'action' : 'menu_direct',
'title' : 'Radio en directo',
'args' : '',
}
menu_entries.append(menu_item)

return menu_entries

Now i can hear radio3.

Thanks.

Hi Vicglez,

Thanks a lot for point me out the problem and the solution. You have got straight to the point with the cause of the problem. I've realized of it some days ago by chance and i've summit release v1.0.5 to the official repos with the fix, so in a few days the new update will be available for everyone.

Once again, a thousand of thanks for all your help and time Big Grin

Best regards,

jamontes.
Reply
#18
Hi Jamontes,

Again, i could not hear radio3 so i began to investigate why, they have changed the url's again. Now are the first one you code in the plugin

http://radiolive.rtve.es

I've changed the code in rne_api.py :

def get_direct_channels():
"""This function makes the direct channels menu."""

direct_url = 'u3m.s%/se.evtr.eviloidar//:ptth'[::-1]

channel_list = (
( 'Radio Nacional', 'rne'),
( 'Radio Clásica', 'radioclasica'),
( 'Radio 3', 'radio3'),
( 'Ràdio 4', 'radio4'),
( 'Radio 5', 'radio5'),
( 'Radio Exterior', 'radioexterior'),
)

menu_entries = []
for channel, playlist in channel_list:
menu_item = {
'action' : 'play_audio',
'title' : channel,
'url' : direct_url % (playlist),
}
menu_entries.append(menu_item)

return menu_entries


def get_playable_url(url):
"""This function gets the stream url for direct channels."""

playable_url_pattern = ')oidua.tsaceci?*.ptth('[::-1]

buffer_url = l.carga_web(url)
stream_url = l.find_first(buffer_url, playable_url_pattern)
l.log('get_playable_url has found this URL for direct playback. url: "%s"' % stream_url)

return stream_url



And now i can hear radio3.


Best regards,
Victor Gonzalez
Reply
#19
(2016-04-09, 14:08)vicglez Wrote: Hi Jamontes,

Again, i could not hear radio3 so i began to investigate why, they have changed the url's again. Now are the first one you code in the plugin

http://radiolive.rtve.es

I've changed the code in rne_api.py :

def get_direct_channels():
"""This function makes the direct channels menu."""

direct_url = 'u3m.s%/se.evtr.eviloidar//:ptth'[::-1]

channel_list = (
( 'Radio Nacional', 'rne'),
( 'Radio Clásica', 'radioclasica'),
( 'Radio 3', 'radio3'),
( 'Ràdio 4', 'radio4'),
( 'Radio 5', 'radio5'),
( 'Radio Exterior', 'radioexterior'),
)

menu_entries = []
for channel, playlist in channel_list:
menu_item = {
'action' : 'play_audio',
'title' : channel,
'url' : direct_url % (playlist),
}
menu_entries.append(menu_item)

return menu_entries


def get_playable_url(url):
"""This function gets the stream url for direct channels."""

playable_url_pattern = ')oidua.tsaceci?*.ptth('[::-1]

buffer_url = l.carga_web(url)
stream_url = l.find_first(buffer_url, playable_url_pattern)
l.log('get_playable_url has found this URL for direct playback. url: "%s"' % stream_url)

return stream_url



And now i can hear radio3.


Best regards,
Victor Gonzalez

Hi Vicglez,

Once again, thanks a lot for let me know of this, and over all, for take your time and point the solution to me.

By the way, did you have the chance to check if the original code work with the rest of direct channels?

If that's the case, i will revert the last changes to the original code and update the official repo with a new release asap.

On one hand it's something annoying to be making changes from time to time to keep the direct channels working, but on the other hand, it's a good thing to have it working back by using the original sources rather than the alternatives ones. So they are good news after all.

Let's crossing fingers and hooping it will remain as is (i.e. working with the original sources) for a long while, as it had to be since the beginnings.

Many thanks for all your help and time, and best regards,

jamontes.
Reply
#20
(2016-04-10, 13:53)jamontes Wrote: ...

Hi Vicglez,

Once again, thanks a lot for let me know of this, and over all, for take your time and point the solution to me.

By the way, did you have the chance to check if the original code work with the rest of direct channels?

If that's the case, i will revert the last changes to the original code and update the official repo with a new release asap.

On one hand it's something annoying to be making changes from time to time to keep the direct channels working, but on the other hand, it's a good thing to have it working back by using the original sources rather than the alternatives ones. So they are good news after all.

Let's crossing fingers and hooping it will remain as is (i.e. working with the original sources) for a long while, as it had to be since the beginnings.

Many thanks for all your help and time, and best regards,

jamontes.

Hi Jamontes,

i've tried with the other direct channel and they work with the new configuration.

Best Regards,
Victor Gonzalez.
Reply
#21
(2016-04-10, 20:12)vicglez Wrote: Hi Jamontes,

i've tried with the other direct channel and they work with the new configuration.

Best Regards,
Victor Gonzalez.

Hi Vicglez,

Thanks a lot for the update. I'll work with the code modifications to go back to the original sources and publish the new release on the official repo asap.

Best regards,

jamontes.
Reply
#22
Hi Jamontes,

I've made changes to you source code because RTVE continues changing it's URLs. I've changed the get_pkayable_url() function, and now it search for tow URLs, because sometimes the "icecast.audio" work and other de "mp3".Look at the source code and tell me what you think.

def get_playable_url(url):
"""This function gets the stream url for direct channels."""

playable_url_pattern1 = ')3pm?*.ptth('[::-1]
playable_url_pattern2 = ')oidua.tsaceci?*.ptth('[::-1]


buffer_url = l.carga_web(url)
stream_url = l.find_first(buffer_url, playable_url_pattern1) or '1'
if stream_url == '1':
stream_url = l.find_first(buffer_url, playable_url_pattern2)

l.log('get_playable_url has found this URL for direct playback. url: "%s"' % stream_url)

return stream_url

Best regards,

Victor Gonzalez.
Reply
#23
(2016-04-27, 19:07)vicglez Wrote: Hi Jamontes,

I've made changes to you source code because RTVE continues changing it's URLs. I've changed the get_pkayable_url() function, and now it search for tow URLs, because sometimes the "icecast.audio" work and other de "mp3".Look at the source code and tell me what you think.

def get_playable_url(url):
"""This function gets the stream url for direct channels."""

playable_url_pattern1 = ')3pm?*.ptth('[::-1]
playable_url_pattern2 = ')oidua.tsaceci?*.ptth('[::-1]


buffer_url = l.carga_web(url)
stream_url = l.find_first(buffer_url, playable_url_pattern1) or '1'
if stream_url == '1':
stream_url = l.find_first(buffer_url, playable_url_pattern2)

l.log('get_playable_url has found this URL for direct playback. url: "%s"' % stream_url)

return stream_url

Best regards,

Victor Gonzalez.

Hi Victor,

Once again, thanks a lot for let me know of the website change as well as the cause of the problem.

I've modified slightly the pattern to support both audio formats without the need to change the code, so I've updated it on release 1.0.7 and submitted a pull request to the official Kodi repo for the Helix brach which you can see here for your review:

https://github.com/xbmc/repo-plugins/pull/453

As usual, it's a pleasure to count with your help and effort in keeping the add-on working fine along the time.

Thanks a lot for your help and best regards,

jamontes.
Reply
#24
Hi Jamontes,

I've noticed that RTVE may have changed permissions, playing their RSS podcasts, as:

Code:
15:33:34.706 T:1958969344   ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3
15:33:35.207 T:1958969344   ERROR: Previous line repeats 1 times.
15:33:35.207 T:1958969344   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 401
15:33:35.208 T:1958969344   ERROR: CCurlFile::Open failed with code 401 for http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3
15:33:35.349 T:1958969344   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 401
15:33:35.350 T:1958969344   ERROR: CCurlFile::Open failed with code 401 for http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3
15:33:35.350 T:1958969344   ERROR: Open - failed to open source <http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3>
15:33:35.351 T:1958969344   ERROR: Init: Error opening file http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3
15:33:35.351 T:1958969344   ERROR: CAudioDecoder: Unable to Init Codec while loading file http://mvod.lvlt.rtve.es/resources/TE_SCASADU/mp3/2/7/1429701428372.mp3
15:33:35.352 T:1958969344 WARNING: PAPlayer::QueueNextFileEx - Failed to create the decoder
15:33:35.353 T:1958969344   ERROR: Playlist Player: skipping unplayable item: 10, path [plugin://plugin.audio.rne/?url=http%3A%2F%2Fmvod.lvlt.rtve.es%2Fresources%2FTE_SCASADU%2Fmp3%2F2%2F7%2F1429701428372.mp3&action=play_audio]

It's not a plugin problem itself, but RTVE about. From now on, you're not able to play any podcast due to 401. I've tried adding a RSS source, same problem, 401 Unauthorized.

Could you take a look?
Reply
#25
Hi Crashillo,

Yes, you are right. Its something weird, because the media link is correct and i can download the files manually by using curl or wget commands without any problem.

Let me have a look at it further and i'll let you know.

Many thanks for point it out.

jamontes.
Reply
#26
Hi Crashillo and Jamontes

This is the log

16:15:52 62566.597656 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Hostname was found in DNS cache
16:15:52 62566.597656 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Trying 206.33.51.125...
16:15:52 62566.675781 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Connected to mvod.lvlt.rtve.es (206.33.51.125) port 80 (#2)
16:15:52 62566.679688 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: HEAD /resources/TE_SCUAND/mp3/5/8/1504275242685.mp3 HTTP/1.1
16:15:52 62566.679688 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: User-Agent: Kodi/16.1 (X11; Linux armv7l) XBian/1.0 HW_RaspberryPi/1.0 App_Bitness/32 Version/16.1-Git:2016-05-28-6f8e95d
16:15:52 62566.679688 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Host: mvod.lvlt.rtve.es
16:15:52 62566.679688 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Accept: */*
16:15:52 62566.679688 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Accept-Charset: UTF-8,*;q=0.8
16:15:52 62566.757812 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: The requested URL returned error: 401 Unauthorized
16:15:52 62566.761719 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Closing connection 2
16:15:52 62566.761719 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Hostname was found in DNS cache
16:15:52 62566.761719 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Trying 206.33.51.125...
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Connected to mvod.lvlt.rtve.es (206.33.51.125) port 80 (#3)
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: GET /resources/TE_SCUAND/mp3/5/8/1504275242685.mp3 HTTP/1.1
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: User-Agent: Kodi/16.1 (X11; Linux armv7l) XBian/1.0 HW_RaspberryPi/1.0 App_Bitness/32 Version/16.1-Git:2016-05-28-6f8e95d
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Host: mvod.lvlt.rtve.es
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Accept: */*
16:15:53 62566.839844 T:1953357824 DEBUG: Curl:Big Grinebug - HEADER_OUT: Accept-Charset: UTF-8,*;q=0.8
16:15:53 62566.921875 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: The requested URL returned error: 401 Unauthorized
16:15:53 62566.921875 T:1953357824 DEBUG: Curl:Big Grinebug - TEXT: Closing connection 3
16:15:53 62566.921875 T:1953357824 ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://mvod.lvlt.rtve.es/resources/TE_SC...242685.mp3

As you can see the error is 401 Unauthorized. I suppose the is this line:

HEADER_OUT: User-Agent: Kodi/16.1 (X11; Linux armv7l) XBian/1.0 HW_RaspberryPi/1.0 App_Bitness/32 Version/16.1-Git:2016-05-28-6f8e95d

I'm going to try change it, if i can :-)))

Best regards,

vicglez.
Reply
#27
Hi vicglez,

I've found what the problem is, and i'm working on the fix (actually it is already done, but i have to fix the search feature as well and make the pull request to the official repo).

The problem has to be with the HTTP HEAD method required by Kodi to know the size and duration of the file to play, which is refused by the current CDN site. Whenever the method used is a GET, there is no problem to access and download the media file. To circumvent this, i've replaced the new URL by the original one, which accepts the HEAD method and allows to reproduce the file as usual. It is supposed that the new CDN will accept the HEAD method some time in the future, as is becoming more and more usual for media content providers, and thus the quick fix is done as a sort of temporal workaround to keep the add-on working as usual.

Please, be patient with the fix, as I'll summit the PR in a couple of days. If you cannot wait till them, try to modify yourself the code on line 267 of file rne_api.py:

Replace this:
url = l.find_first(audio_section, audio_link_pattern)

By this:
url = l.find_first(audio_section, audio_link_pattern).replace('mvod.lvlt', 'www')

And that's it.

In the mean time, i'll take the chance to fix the search feature, which is actually broken due to a website internal change.

Many thanks to you both for the help and the hints.

Best regards,

jamontes.
Reply
#28
You're the best,

I've made the changes and is working again.

[Edit]

I've tried with Firefox and "mvod.lvlt.rtve.es' is replaced by 'mvod1.akcdn.rtve.es'

[End Edit]

Thanks,

Best Regards,

vicglez.
Reply
#29
Hi Jamontes,

Again, i could not hear radio3 so i began to investigate why, they have changed the url's again. Here they are:

Radio 1: http://rtve-live.hds.adaptive.level3.net.../live.m3u8
Radio 2: http://rtve-live.hds.adaptive.level3.net.../live.m3u8
Radio 3: http://rtve-live.hds.adaptive.level3.net.../live.m3u8
Radio 4: http://rtve-live.hds.adaptive.level3.net.../live.m3u8
Radio 5: http://rtve-live.hds.adaptive.level3.net.../live.m3u8
Radio Exterior: http://rtve-live.hds.adaptive.level3.net.../live.m3u8

They have change the format too, so i don't know how to change the source code in order to hear the radio.

[edit]

I've modified source code and it works

rne_api.py

def get_direct_channels():

    """This function makes the direct channels menu."""

#    direct_url    = 'u3m.s%/se.evtr.eviloidar//:ptth'[::-1]
    direct_url    = '8u3m.evil/_tsnifed_/0lgmoa3vls%enr-0lgenr/evil-slh/ten.3level.evitpada.sdh.evil-evtr//:ptth'[::-1]
    channel_list  = (
            ( 'Radio Nacional',   '1'),
            ( 'Radio Clásica',    '2'),
            ( 'Radio 3',          '3'),
            ( 'Ràdio 4',          '4'),
            ( 'Radio 5',          '5'),
            ( 'Radio Exterior',   '6'),
            )

    menu_entries  = []
    for channel, playlist in channel_list:
        menu_item = {
                'action' : 'play_audio',
                'title'  : channel,
                'url'    : direct_url % playlist,
        }
        menu_entries.append(menu_item)

    return menu_entries

[End Edit]

Best Regards,

Victor Gonzalez
Reply
#30
Hi Victor,

That's excellent!! You have found the new URLs and updated the code right like i would do it.

Now it's my turn to say "you are the best!" :-)

Thanks a lot for the great work (i must say as usual). I'll apply the code fix along with the rest of fixes for the next PR (i'm very sorry for not doing it so quick, but i'm very busy lately).

I'll be back to let you know when the PR is summit to the official repos.

Best regards,

jamontes.
Reply

Logout Mark Read Team Forum Stats Members Help
RNE Podcasts add-on for KODI0