Kodi Community Forum
Need help in coding plugin for flimicity.in - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Need help in coding plugin for flimicity.in (/showthread.php?tid=56764)

Pages: 1 2 3 4


Need help in coding plugin for flimicity.in - sansat - 2009-08-23

Hello All,

I am a very new user and have tried to create a plugin for

http://www.filmicity.in

the plugin details can be fould at

http://pastebin.com/f694e2eec

I have following issues:

1. I am able to see list of shows but cannot play them it gives the python error - this is the foremost and most important issue - please guide ..

2. How do I mention in the plugin to show next page option bcos currently it list only the first 45 videos in the fisrt page so how will i see the other videos in other pages

3. On the site the videos are in parts so how do I list all the parts

Please guide

Thanks


- sansat - 2009-08-24

Anyone ?

I have also tried the below code

http://pastebin.com/f685f4a48

But still no luck

would appreciate a reply from experienced plugin writers

thanks


- sansat - 2009-08-24

I have also tried below code to see if I could get the pages and parts listed but no luck - in below code its not even listing videos of first page..

http://pastebin.com/f5827509f

Please guide in making this plugin work for http://www.filmicity.in

Thanks


- stacked - 2009-08-24

sansat Wrote:I have also tried below code to see if I could get the pages and parts listed but no luck - in below code its not even listing videos of first page..

http://pastebin.com/f5827509f

Please guide in making this plugin work for http://www.filmicity.in

Thanks

Some tips:
- Turn on debug logging for xbmc
- look through the log after an error appears
- try to fix any errors before adding more code
- add print statements around your code so you can see what is getting passed through the plugin

Just by looking at the debug log I found your problem in a couple of seconds. I also added "print match" so I can see whats going on.

Code:
08:10:03 T:408 M:551960576  NOTICE: [('http://i27.tinypic.com/x6alx2.png', '17 Aug Thank You JiJaJi', '17 Aug Thank You JiJaJi'), ('http://i29.tinypic.com/2qutamc.jpg', '23 Aug Baa Bahoo Aur Baby - Season 2 * Episode 1', '23 Aug Baa Bahoo Aur Baby - Season 2 * Episode 1'), ('http://i43.tinypic.com/15g32wl.jpg', '22 Aug Sssshhh Phir Koi Hai', '22 Aug Sssshhh Phir Koi Hai'), ('http://i28.tinypic.com/mct5pv.jpg', '23 Aug MTV Stunt Mania', '23 Aug MTV Stunt Mania'), ('http://upload.wikimedia.org/wikipedia/en/thumb/9/99/DekhInidaDekh02.jpg/250px-DekhInidaDekh02.jpg', '22 Aug Dekh India Dekh', '22 Aug Dekh India Dekh'), ('http://i42.tinypic.com/2url6z7.jpg', '22 Aug 10 Ka Dum 2 * Navjot Singh Sidhu & Kapil Dev', '22 Aug 10 Ka Dum 2 * Navjot Singh Sidhu & Kapil Dev'), ('http://i42.tinypic.com/4vseq9.jpg', "22 Aug India's Got Talent - Grand Finale", "22 Aug India's Got Talent - Grand Finale"), ('http://i43.tinypic.com/15g32wl.jpg', '21 Aug Sssshhh Phir Koi Hai', '21 Aug Sssshhh Phir Koi Hai'), ('http://i31.tinypic.com/xngk0j.jpg', '22 Aug Tere Mere Beach Mein * Salman Khan', '22 Aug Tere Mere Beach Mein * Salman Khan'), ('http://i41.tinypic.com/2ptyofb.jpg', '22 Aug MTV Connected - Grand Finale', '22 Aug MTV Connected - Grand Finale'), ('http://i42.tinypic.com/eknwgm.jpg', "22 Aug L'il Champs", "22 Aug L'il Champs"), ('http://i42.tinypic.com/105s7b8.jpg', '21 Aug CID', '21 Aug CID'), ('http://i42.tinypic.com/eknwgm.jpg', "21 Aug L'il Champs", "21 Aug L'il Champs"), ('http://i28.tinypic.com/5cyj5w.jpg', 'Because My Name is Khan', 'Because My Name is Khan'), ('http://i27.tinypic.com/qs8i77.png', 'AR Rahman Unplugged', 'AR Rahman Unplugged'), ('http://i31.tinypic.com/fyir8m.jpg', 'SRK Speaks on US Airport Detention', 'SRK Speaks on US Airport Detention'), ('http://i29.tinypic.com/4qmq7m.png', 'The Making of Kaminey', 'The Making of Kaminey'), ('http://i43.tinypic.com/15g32wl.jpg', '15 Aug Sssshhh Phir Koi Hai', '15 Aug Sssshhh Phir Koi Hai'), ('http://i42.tinypic.com/4vseq9.jpg', "16 Aug India's Got Talent - Wild Card Entry", "16 Aug India's Got Talent - Wild Card Entry"), ('http://i29.tinypic.com/25zjtjb.jpg', '16 Aug Vikram Aur Betaal', '16 Aug Vikram Aur Betaal'), ('http://i26.tinypic.com/68547c.jpg', '16 Aug Khana Khazana', '16 Aug Khana Khazana'), ('http://i28.tinypic.com/mct5pv.jpg', '16 Aug MTV Stunt Mania', '16 Aug MTV Stunt Mania'), ('http://upload.wikimedia.org/wikipedia/en/thumb/9/99/DekhInidaDekh02.jpg/250px-DekhInidaDekh02.jpg', '15 Aug Dekh India Dekh', '15 Aug Dekh India Dekh'), ('http://i39.tinypic.com/s3g4xy.jpg', '15 Aug Hans Baliye * Grand Finale', '15 Aug Hans Baliye * Grand Finale'), ('http://i42.tinypic.com/4vseq9.jpg', "15 Aug India's Got Talent", "15 Aug India's Got Talent"), ('http://i42.tinypic.com/eknwgm.jpg', "15 Aug L'il Champs", "15 Aug L'il Champs"), ('http://i42.tinypic.com/2url6z7.jpg', '15 Aug 10 Ka Dum 2 * Independence Day Special', '15 Aug 10 Ka Dum 2 * Independence Day Special'), ('http://i42.tinypic.com/105s7b8.jpg', '14 Aug CID', '14 Aug CID'), ('http://i43.tinypic.com/15g32wl.jpg', '14 Aug Sssshhh Phir Koi Hai', '14 Aug Sssshhh Phir Koi Hai'), ('http://i42.tinypic.com/eknwgm.jpg', "14 Aug L'il Champs", "14 Aug L'il Champs"), ('http://i25.tinypic.com/2r5sr40.jpg', '13 Aug To Catch a Star * Shahid Kapoor on Kaminey', '13 Aug To Catch a Star * Shahid Kapoor on Kaminey'), ('http://i27.tinypic.com/x6alx2.png', '10 Aug Thank You JiJaJi', '10 Aug Thank You JiJaJi'), ('http://i26.tinypic.com/s63r82.jpg', 'SRK * Karan Johar on My Name is Khan', 'SRK * Karan Johar on My Name is Khan'), ('http://i42.tinypic.com/4vseq9.jpg', "9 Aug India's Got Talent", "9 Aug India's Got Talent"), ('http://i26.tinypic.com/sn2mx5.png', '9 Aug Aaj Tak Seedhi Baat * Rakhi Sawant', '9 Aug Aaj Tak Seedhi Baat * Rakhi Sawant'), ('http://i28.tinypic.com/mct5pv.jpg', '9 Aug MTV Stunt Mania', '9 Aug MTV Stunt Mania'), ('http://i39.tinypic.com/s3g4xy.jpg', '8 Aug Hans Baliye', '8 Aug Hans Baliye'), ('http://i43.tinypic.com/15g32wl.jpg', '8 Aug Sssshhh Phir Koi Hai', '8 Aug Sssshhh Phir Koi Hai'), ('http://upload.wikimedia.org/wikipedia/en/thumb/9/99/DekhInidaDekh02.jpg/250px-DekhInidaDekh02.jpg', '8 Aug Dekh India Dekh', '8 Aug Dekh India Dekh'), ('http://i42.tinypic.com/4vseq9.jpg', "8 Aug India's Got Talent", "8 Aug India's Got Talent"), ('http://i41.tinypic.com/2ptyofb.jpg', '8 Aug MTV Connected', '8 Aug MTV Connected'), ('http://i42.tinypic.com/eknwgm.jpg', "8 Aug L'il Champs", "8 Aug L'il Champs"), ('http://i42.tinypic.com/2url6z7.jpg', '8 Aug 10 Ka Dum 2 * Sanjay Dutt and Jackie Shroff', '8 Aug 10 Ka Dum 2 * Sanjay Dutt and Jackie Shroff'), ('http://i42.tinypic.com/105s7b8.jpg', '7 Aug CID', '7 Aug CID'), ('http://i43.tinypic.com/15g32wl.jpg', '7 Aug Sssshhh Phir Koi Hai', '7 Aug Sssshhh Phir Koi Hai')]
08:10:03 T:408 M:551956480  NOTICE: Traceback (most recent call last):
08:10:03 T:408 M:551956480  NOTICE:   File "C:\Documents and Settings\Administrator\Application Data\XBMC\plugins\video\PBS Video\default.py", line 432, in ?
08:10:03 T:408 M:551956480  NOTICE: INDEX(url)
08:10:03 T:408 M:551956480  NOTICE:   File "C:\Documents and Settings\Administrator\Application Data\XBMC\plugins\video\PBS Video\default.py", line 36, in INDEX
08:10:03 T:408 M:551956480  NOTICE: for url,name in match:
08:10:03 T:408 M:551956480  NOTICE: ValueError
08:10:03 T:408 M:551956480  NOTICE: :
08:10:03 T:408 M:551956480  NOTICE: too many values to unpack
08:10:03 T:408 M:551956480   ERROR: Scriptresult: Error

So each element in the match array has 3 "arguments or parameters", but you are only address 2 (url,name) eg. ('http://i27.tinypic.com/x6alx2.png', '17 Aug Thank You JiJaJi', '17 Aug Thank You JiJaJi') You forgot to include the third argument in the for loop. Replace, "for url,name in match:" in line 34 with "for url,name,trash in match:" This gets the plugin running without errors. It doesn't exactly work because the url you are passing is a image and not a page.

I added a few lines to get the plugin running and playing a video. You still need to find a way to get to the other pages.
download: http://pastebin.com/m13b89026
btw, take a look at my changes under the diff...
http://pastebin.com/pastebin.php?diff=m13b89026


btw, I just wanna say thanks and congrats on trying to write your own plugin. Wink Most ppl would just request for a plugin rather than trying to make it for them self.


- sansat - 2009-08-24

Thankyou very much for your reply.

I will try the code you have corrected and let you know.

Also I suppose the logs have to be enabled in the xbmc settings and view them in logs folder if there is some other procedure then do let me know.

Thanks


- sansat - 2009-08-24

Excellent, the video is working. Thanks a lot

One question before I try to figure out how to get the pages working, the videos have multiple parts and it shows only the first part :

I chose the section in source which shows the videos to play the previous and next video eg - <a href="videos.php?id=14124" > and was written as below so am not sure if that was right to get the other parts to be listed :

Code:
match=re.compile('<a href="videos.php?id=(.+?)"</a>').findall(link)
                addDir('Part  1',url,4,'')
                
                for url,name in match:
                        addDir('Part '+name,url,4,'')

Please let me know.

Thanks


- stacked - 2009-08-24

sansat Wrote:Excellent, the video is working. Thanks a lot

One question before I try to figure out how to get the pages working, the videos have multiple parts and it shows only the first part :

I chose the section in source which shows the videos to play the previous and next video eg - <a href="videos.php?id=14124" > and was written as below so am not sure if that was right to get the other parts to be listed :

Code:
match=re.compile('<a href="videos.php?id=(.+?)"</a>').findall(link)
                addDir('Part  1',url,4,'')
                
                for url,name in match:
                        addDir('Part '+name,url,4,'')

Please let me know.

Thanks

Thats not going to work. I think the best way would be to find out how parts each video has (eg. do a regex of "1 of #"). Then you can just manually generate the pages.


- sansat - 2009-08-25

How to do - regex of "1 of #" - is it something which is done in python shell or in the source?

Also do I have to manually go through each video and find the parts ?

Please let me know

Thanks


- sansat - 2009-08-25

Ok I googled it and found regex is regular expressions - so I tried something like below to test the result

Code:
import urllib2,urllib,re

url='http://www.filmicity.in/videos.php?id=14093'

req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('1 of (.+?)').findall(link)
print match

And I got

Code:
['4']

So it means it has 4 parts right - then do I to do it for each video ?


- sansat - 2009-08-25

Also I am trying to create one for http://www.rajshri.com where video is not in parts which is good ...but one has to login to this site: (free login)

How can we pass username/password via the plugin to the site - is it possible.

Sorry, I am asking too many questions but it will help in deciding if its worth the effort creating the plugin for this site.

Thanks


- stacked - 2009-08-25

sansat Wrote:Ok I googled it and found regex is regular expressions - so I tried something like below to test the result

Code:
import urllib2,urllib,re

url='http://www.filmicity.in/videos.php?id=14093'

req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('1 of (.+?)').findall(link)
print match

And I got

Code:
['4']

So it means it has 4 parts right - then do I to do it for each video ?

Yeah. So if it has 4 parts and part 1 id=14093, you can assume that ids for parts 2,3, and 4 is 14094,14095,14096. For this example, you could just do a for loop that addDir for all parts with the correct url.


- sansat - 2009-08-25

Ok,

Can you please let me know a sample print statement where you can see whats been passed through the plugin, like you showed in your debug output and where exactly it should be placed.

Thanks


- stacked - 2009-08-25

sansat Wrote:Ok,

Can you please let me know a sample print statement where you can see whats been passed through the plugin, like you showed in your debug output and where exactly it should be placed.

Thanks

you just put the print statement right after the variable you want to see.

For ex:

match=re.compile('szasdsa(.+?)sadas').findall(asds)
print match

And it will show up in the xbmc.log

btw, make google is your friend. You can find alot of python examples or tutorials. For example, google: python print examples


- sansat - 2009-08-25

I had tried that and it was erroring out, will try it again and keep you posted.

Also can you please let me know if its possible to pass username/passwords via the plugin for http://www.rajshri.com ?

Thanks


- stacked - 2009-08-26

sansat Wrote:I had tried that and it was erroring out, will try it again and keep you posted.

Also can you please let me know if its possible to pass username/passwords via the plugin for http://www.rajshri.com ?

Thanks

I code above was just an example, it doesn't work.

It's possible to use username/pass, but I haven't done it myself yet.

Again, google it or see how someone else done it on a different plugin:
http://code.google.com/p/xbmc-addons/source/checkout