mathsgrinds / IETVNOW

Plays 12 live Irish TV stations (RTE1, RTE2, TV3, TG4, 3e, be3, RTEjr, RTE1 +1, RTE NEWS NOW, Oireachtas TV, Dail, Seanad)
Apache License 2.0
6 stars 3 forks source link

Great Work! A request! #1

Closed rlaphoenix closed 8 years ago

rlaphoenix commented 8 years ago

Could you PLEASE add support for TV Guides? As in make a router() mode like:

def play_fav(channel):
    xbmc.log("playing fav now..................")
    for video in get_videos('Live Irish TV'):
        if video['name'] == channel:
            xbmc.log("Name: " + str(video['name']))
            xbmc.log("Url: " + str(video['video']))
            play_item = xbmcgui.ListItem(path=str(video['video']))
            xbmcplugin.setResolvedUrl(__handle__, True, listitem=play_item)
            xbmc.log("It should be playing...................")
        xbmc.log("Looping............................")

def router(paramstring):
    params = dict(parse_qsl(paramstring[1:]))
    if params:
        if params['action'] == 'listing':
            list_videos(params['category'])
        elif params['action'] == 'play':
            play_video(params['video'])
        elif params['action'] == 'upd':
            play_fav(params['channel'])
    else:
        list_categories()

(Note: Code above is just an example, I tried to make it work but it wouldn't work for some reason.)

Just please set something up like that so we can do something like: plugin://plugin.video.live.irish.tv/?action=upd&channel=UTV Which would generate a new token and play the stream so that we can use TV Guide applications nice and smooth.

Great work was looking for something to play Irish streams since Irish TV was dead. This deserves much more <3

Also plz remove the pointless "Category".

And RTE 1+2 never seem to work. (The official streams are DRM protected, But not aertv.ie's ones. I can only manage to get the stream url from using Fiddler to sniff the url: http://pastebin.com/raw/6wUV4V98 But the token NEEDS to be one tied to YOUR ip. So somehow try and find a way to get the token and replace it on that url base. (If you need the base urls for the other aertv channels let me know, I can sniff em)

Great work was looking for something to play Irish streams since Irish TV was dead. This deserves much more <3

mathsgrinds commented 8 years ago

:) no space, let me put it in a txt file

rlaphoenix commented 8 years ago

Its good! Ill get the spaces in

mathsgrinds commented 8 years ago

code.txt

rlaphoenix commented 8 years ago

Testing it now, Hopefully it goes well :D

mathsgrinds commented 8 years ago

eekk exciting

rlaphoenix commented 8 years ago

Also is it just me or if you go into Addons > My Addons > Video Addons > IETVNOW > Open it insta opens but doesnt actually request the urls? It just instantly lists the streams?

mathsgrinds commented 8 years ago

maybe just you, mine is still working to get the streams

rlaphoenix commented 8 years ago

I think mine is bugged. Im gonna add the tv3 and 3e thing you mentioned and make a pull request so you can test.

mathsgrinds commented 8 years ago

cool

rlaphoenix commented 8 years ago
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.KeyError'>
Error Contents: ('video',)
Traceback (most recent call last):
  File "C:\Users\Shiny\AppData\Roaming\Kodi\addons\plugin.video.ietvnow\main.py", line 122, in <module>
    router(sys.argv[2])
  File "C:\Users\Shiny\AppData\Roaming\Kodi\addons\plugin.video.ietvnow\main.py", line 117, in router
    play_video(params['video'])
KeyError: ('video',)
-->End of Python script error report<--

Getting this error, No idea why, Seems like the new code doesnt output any url so somethings going wrong :/ Can you help with xbmc.log at different sections to see where it starts to fail when I make the pull request?

rlaphoenix commented 8 years ago

Sent out the pull request

rlaphoenix commented 8 years ago

Go onto my Profile -> IETVNOW -> Main.py and copy and paste the AerTV code - Delete the quality thing as it wont do anything anymore, delete code() too and commit

rlaphoenix commented 8 years ago

also add username and password options into Addon Config and reference them as "email" and "password" variables under tv3_stream

rlaphoenix commented 8 years ago

Also change in the streams() the RTE_News_Now.jpg to .png :P

rlaphoenix commented 8 years ago

By the looks of things its an error to do with Streams() and the AerTV() bits as its not even requesting the url at all. I can tell because it doesnt show any signs of AerTV at all on Fiddler.

rlaphoenix commented 8 years ago

Got it! Its generating tokens properly! The streams wont play doe so theres something wrong with the token or the url :/ Gonna try something really quick.

rlaphoenix commented 8 years ago

Damn it! The stream tokens generated on the User Page doesnt work for the streams D: We need to somehow after logging in redirect to the stream page and capture the generated stream link from there.

rlaphoenix commented 8 years ago

Atleast its logging in now we can find where to go from here :P

rlaphoenix commented 8 years ago

I dont know where to go from here :/ It does seem like the streamtoken is generated from Javascript so thats an issue :/ If I look in fiddler this is where the streamtoken is shown: https://api.aertv.ie/v2/players/rte-one?user_token=d538e40593ac364f61596aa161cf7c1d31c0d4208985e9bcb27599180a6f623a_1473382949

But then its also shown: http://jwpltx.com/v1/jwplayer6/ping.gif?tv=1.1.0&n=2185237983768145&aid=OWbyWpvhEeSaYgp%2BlcGdIw&e=e&i=0&ifd=0&pv=6.12.4956&m=0&d=1&t=RT%C3%89%20One&ph=0&ed=2&ps=4&fv=22.0r0&pl=336&wd=597&sdk=0&emi=ye7a2l8h0741&pli=8voj46iuxvax&mu=rtmp%3A%2F%2Fd-deg-mcdn.magnet.ie%3A1935%2Frtplive%2Frte-one-v1500.stream%3Fstreamtoken%3D802bd50af55c8dff0cd9d16b587d316b7431b1b0e759f56392d62d7436e379bc_1473384759&eb=1&id=&pu=http%3A%2F%2Fwww.aertv.ie%2F&pt=Aertv%20%7C%20Watch%20Live%20TV%20On%20The%20Go

This is really odd, But both tokens are different, So maybe the /v2/player link we use the token from the Login API and then it generates a second one that will show up in source somewhere?

rlaphoenix commented 8 years ago

Yup I was right :D Haha!!! {"statusCode":200,"statusMessage":"OK","data":{"title":"RT\u00c9 One","subscribed":true,"packages":["free","platinum","plus"],"urls":{"logo":"https:\/\/aertv.s3.amazonaws.com\/wp-content\/uploads\/2013\/03\/rte_one_162x129.png","stream":{"hls":"http:\/\/d-deg-mcdn.magnet.ie:1935\/rtplive\/smil:rte-one.smil\/playlist.m3u8?streamtoken=bb3e73ebbe45dad840838f7fd5dabfacff22982e3a5887f9fd0aac415a68cfd8_1473384993","rtmp":[{"source":"rtmp:\/\/d-deg-mcdn.magnet.ie:1935\/rtplive\/rte-one-v500.stream?streamtoken=cfc507054cef1efcad33e81c305a9dfe3078da1b562b90bef93246950008135a_1473384993","bitrate":"500000","type":"video"},{"source":"rtmp:\/\/d-deg-mcdn.magnet.ie:1935\/rtplive\/rte-one-v1500.stream?streamtoken=87286e966dbb35e3120b2eaa30a8491f61b07b2b4ae47f59934ec9167cc54b0a_1473384993","bitrate":"1500000","type":"video"},{"source":"rtmp:\/\/d-deg-mcdn.magnet.ie:1935\/rtplive\/rte-one-v200.stream?streamtoken=99ae216efe70ccd899dbf11d9a75532752e7af36a8c3c3c457b76151a894e452_1473384993","bitrate":"200000","type":"video"}]}}}}

Now we need to just parse that! Ill leave that up to you as im tired as fuck! XD

rlaphoenix commented 8 years ago

Lol Cant get to sleep knowing we are 3 mins away from finishing this :P Are you still awake? :/

mathsgrinds commented 8 years ago

I put up a version, which has the username and password of over 200 accounts, depending on the time of the day the addon will use a different usename and password to log in thus allowing the user continuous viewing without needing an account, the next thing would be to add in a log in feature so that when the log in with their (one would assume non free account) they can view all the channels but that's for another day I think :)

mathsgrinds commented 8 years ago

So, I have the add-on on my laptop and my TV and it works in both. So that's cool.

rlaphoenix commented 8 years ago

I got it working! :O The only thing it needs is the HD on/off thing implemented - Each station/channel has varying amount of Streams - RTE One, and Two have 3 streams, Bad Stream, Ok Stream and "HD" Stream. But RTEjr only has Ok Stream and "HD" Stream. So links[3] isnt going to work, No idea where you got 3 from anyway, Remember you have to count 0 as 1 it doesnt start at 1 it starts at 0. so 3rd stream would be links[2]. Atm so that it ALWAYS works I set it to always be the first stream which is usually the bad stream :/ But I cant set it to the good one cause it varies as I said.

To implement the HD thing, We need to extract the ?bitrate={} from each link (Which we also need to calculate somehow) and then just do a if {link1Bitrate} > {link2bitrate} And HD = True: {playlink1}

You still have a lot of differences to my code. So all I can say is, Just overwrite the whole code with mine (It has the def three_e and tv3 thing): EDIT: Im gonna just implement the changes you made and then update this EDIT 2: The changes you made isn't really needed, Ill test with a dummy account as I myself actually have a premium account. EDIT 3: Ahh yes, It definitey does block after times up, Honestly doe, Due to the amount of people who will actually end up using this I highly dought that it will actually make it work for a long viewing time it will constantly cut out (You will need to re-play) and there literally wont be enough accounts no matter how many you make it will just be a waste of time making them.

The main reason I needed this made was to get my plus account working on Kodi. I guess the AerTV side will only work for people who bought a subscription. :/

Here's the file and it has the Email and Password options in Settings.xml For aerTV to work, All you needa do is enter in an Email and Password of a Plus or Platinum account and boom it will work :D

main.txt settings.txt

rlaphoenix commented 8 years ago

Odd your messages only just showed up now. All I can say is that with free links im pretty sure it still works for longer then 1 minute or whatever it is, Because im pretty sure its just the Player that cuts you off and it then stores a cookie that blocks playing, Cause if you delete aertv cookies and then refresh it works again.

mathsgrinds commented 8 years ago

And it's not tied to IP address, because I have it playing on my laptop and the tv at once (I'm no a VPN on my laptop).

rlaphoenix commented 8 years ago

I guess this "issue" is sorted! :D Closing

rlaphoenix commented 8 years ago

"And it's not tied to IP address, because I have it playing on my laptop and the tv at once (I'm no a VPN on my laptop)." :facepalm: Lol, Your Internet stays as 1 IP no matter what device you use. All Devices on the same internet use the same IP. Thats why its working :P If you use a VPN on an Ireland VPN (Never works on US etc only Ireland and UK) then it wont work because its a different IP.

rlaphoenix commented 8 years ago

Also last thing, You should lookup things called "Repo's" You probably skipped it since you only have 1 plugin but its not really a Folder or anything, Its like a main Hub application where it will update all other applications in the repo automatically so people dont need to reinstall from zip file every single time theres an update if they can even bother to come back and check xD You should look into it :) If you dont care to make your own repo I HIGHLY recommend looking into tvaddongs.ag's MASTER repo - Literally like every single Kodi user has that repo. Just look around the website and find more about it (Not exactly sure how it works out to make ur own but it is free etc)

mathsgrinds commented 8 years ago

I will thanks, but with the IP thing, is it not the case that when my VPN is on, the ip address appears different? So, with the TV playing and the PC playing, does it not show it can work with two different IP addresses?

mathsgrinds commented 8 years ago
mathsgrinds commented 8 years ago

PPS: I've cleaned up the scraping code so changing the stream should work

mathsgrinds commented 8 years ago

ppps: I know I need to merge things :)

rlaphoenix commented 8 years ago

For the first reply I have no idea what your tryna say lmao When are you merging? Using a pull request wont work cause its all weird so just change the files as necessary