Sign up here and you can log into the forum!

DailyMotion Plugin

UMSP Plugin Depot, the place for sharing plugins & info about them. No requests, just plugins/code.

DailyMotion Plugin   

Postby eskay » Sun Aug 07, 2011 10:22 am

!!!!Important ::: Please enable the plugin using Addon-manager
sample config file dailymotion-config.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<list>
  <user>
    <propername>Channel - News</propername>
    <userid>news</userid>
    <type>channel</type>
  </user>
  <user>
    <propername>Channel - Music</propername>
    <userid>music</userid>
    <type>channel</type>
   </user>
  <user>
    <propername>USER ::: DTFDVDvideos1</propername>
    <userid>DTFDVDvideos1</userid>
    <type>user</type>
  </user>
</list>


Hello there!!.. A plugin for daily motion
version 2 (Thanks to MAD_ADY)
Code: Select all
* res queries go to $_SERVER['HTTP_HOST'] instead of localhost
* WEC - added extra information about the config variables
* fixed the proxy name to dailymotion-proxy.php instead of dmotion-proxy.php
* changed proxy path in res call to dailymotion/dailymotion-proxy.php
* fixed bug where only the last page of results was displayed ($count was set instead of $i)
* fixed search (url parameter must be sent as array), but some search items still fail - e.g. Katy
* fixed config_data <-> configData typo in _pluginCreateItemList. All the results were independent of the country selected.
* changed proxy code to look like standard proxies. Replaced string cutting with one regex. Also, added quality selector (for videos that support it).
* various changes in logging messages. Changed default logging to L_WARNING

Version 3
Code: Select all
changelog.
*added support for direct rss url
*removed entry for maxresult in XML
example entry in XML
===============================
<list>
<user>
    <propername>Channel ::: shortfilm</propername>
    <userid>http://www.dailymotion.com/rss/gb/featured/channel/shortfilms/1?autoplay=1</userid>
    <type>rss</type>
  </user>
<list>
===================================
*support for previous and Next for navigation(Depends on rss feed)
*Support for multiple sort option (Depends on rss feed)


Version 4
Code: Select all
changelog:
*Added support for RSS which does not return the video url
Last edited by eskay on Mon Sep 19, 2011 10:39 am, edited 3 times in total.
User avatar
eskay
Developer
 
Posts: 130
Joined: Mon Aug 02, 2010 12:56 pm
Location: SWITZERLAND

Re: DailyMotion Plugin   

Postby mad_ady » Sun Aug 07, 2011 11:57 pm

Good job eskay!

I'm trying out the code now and making small improvements. I will try to publish it to svn later today and post back.
User avatar
mad_ady
Developer
 
Posts: 3002
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: DailyMotion Plugin   

Postby mad_ady » Mon Aug 08, 2011 5:33 am

Ok, I finished making the changes (took a while, didn't it?) and I posted the plugin on SVN: http://svn.wdlxtv.com/revision.php?repname=UMSP&peg=240&rev=241

Changelog:
Code: Select all
* res queries go to $_SERVER['HTTP_HOST'] instead of localhost
* WEC - added extra information about the config variables
* fixed the proxy name to dailymotion-proxy.php instead of dmotion-proxy.php
* changed proxy path in res call to dailymotion/dailymotion-proxy.php
* fixed bug where only the last page of results was displayed ($count was set instead of $i)
* fixed search (url parameter must be sent as array), but some search items still fail - e.g. Katy
* fixed config_data <-> configData typo in _pluginCreateItemList. All the results were independent of the country selected.
* changed proxy code to look like standard proxies. Replaced string cutting with one regex. Also, added quality selector (for videos that support it).
* various changes in logging messages. Changed default logging to L_WARNING


eskay - please try out the submitted plugin (make sure you are not overwriting it with your version on your box). See if there's anything broken. Also, look over the code and ask if there are things which are unclear. You did a good job with the code - I just tied a few loose ends.

Here are some things that can be improved in the plugin:
Code: Select all
TODO:
* search doesn't always work - e.g. searching for test works, but searching for katy doesn't (even if dailymotion returns results) - to investigate
* add pagination support (instead of downloading 3 pages, add a Next entry - similar to Vimeo)
* investigate if it's worth to migrate to the official API: https://github.com/dailymotion/dailymotion-sdk-php/blob/master/Dailymotion.php Might give back more data (or not).


If you want to make additional changes, send me a diff between your version and the svn version and I will patch it.
User avatar
mad_ady
Developer
 
Posts: 3002
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: DailyMotion Plugin   

Postby KAD » Mon Aug 08, 2011 7:36 am

moved from discussions to UMSP Plugins

good work :D

KAD
If you like my work please consider a Donation. Donate
Please read the appropriate documentation before posting questions! READ ME FAQ WIKI
User avatar
KAD
Global Moderator
 
Posts: 4015
Joined: Mon Apr 12, 2010 4:59 pm
Location: Seattle, WA USA

Re: DailyMotion Plugin   

Postby eskay » Mon Aug 08, 2011 8:15 am

thanks a lot @mad_ady & @KAD -

@mad_ady : i will have a look to ur changes and belive that it will be better than mine (ur expert).
TODO:
* search doesn't always work
add pagination support (instead of downloading 3 pages, add a Next entry - similar to Vimeo)

i will work on the todo's and pagination is already in my list. And loop was designed to select the no. of pages as given in user configuration.

And your encouragement will help me to publish the next "Indian Channel Forums"... :D
User avatar
eskay
Developer
 
Posts: 130
Joined: Mon Aug 02, 2010 12:56 pm
Location: SWITZERLAND

Re: DailyMotion Plugin   

Postby mad_ady » Mon Aug 08, 2011 8:22 am

Also, I thought of another possible improvement - setting the sort order for the results. I believe you can request them in any order you want (most popular this week/most viewed this month) directly in the RSS XML form.
User avatar
mad_ady
Developer
 
Posts: 3002
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: DailyMotion Plugin   

Postby eskay » Mon Aug 08, 2011 9:54 am

mad_ady wrote:Also, I thought of another possible improvement - setting the sort order for the results. I believe you can request them in any order you want (most popular this week/most viewed this month) directly in the RSS XML form.

Hey i looked into ur changes and u madae it perfect.... :) So now the credit of this plugin should go to you mad_ady ... not to me.
and for me happy learning of PHP ....
User avatar
eskay
Developer
 
Posts: 130
Joined: Mon Aug 02, 2010 12:56 pm
Location: SWITZERLAND

Re: DailyMotion Plugin   

Postby mad_ady » Mon Aug 08, 2011 10:00 am

If I take credit for it (or shared credit), then I must be available to maintain and troubleshoot the plugin as well... So, nice try, but the responsibility is yours :mrgreen:
User avatar
mad_ady
Developer
 
Posts: 3002
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: DailyMotion Plugin   

Postby eskay » Thu Aug 11, 2011 12:31 pm

hello mad_ady,

As you suggested please update the pattern of dailymotion-proxy.php as below in SVN
Code: Select all
if(preg_match('/sdURL%22%3A%22(.*?)(?:%22%2C%22hqURL%22%3A%22(.*?))?(?:%22%2C%22hd720URL%22%3A%22(.*?))?(?:%22%2C%22hd1080URL%22%3A%22(.*?))?%22%2C%22allowStageVideo/', $content, $matched)){
   


Your assumption was right earlier pattern is failing if video of all formats are not available.
User avatar
eskay
Developer
 
Posts: 130
Joined: Mon Aug 02, 2010 12:56 pm
Location: SWITZERLAND

Re: DailyMotion Plugin   

Postby mad_ady » Thu Aug 11, 2011 9:42 pm

Hello eskay,

I pushed the fix in the svn. I've tested it a bit, and it seems to work.

I don't know why sometimes I get xml parsing errors, even if the returned content seems to be XML... For example, I get the exception now with Recent Videos:
Code: Select all
2011.08.12 08:36:48 DailyMotion - Error parsing RSS result: exception 'Exception' with message 'String could not be parsed as XML' in /tmp/umsp-plugins/dailymotion/dailymotion-helper.php:123
Stack trace:
#0 /tmp/umsp-plugins/dailymotion/dailymotion-helper.php(123): SimpleXMLElement->__construct('<?xml version="...')
#1 /tmp/umsp-plugins/dailymotion/dailymotion.php(67): _createVideoItems('http://www.dail...')
#2 /tmp/umsp-plugins/dailymotion/dailymotion.php(20): _pluginCreateVideoItems(Array)
#3 /usr/share/umsp/funcs-misc.php(18): _pluginMain('plugin=dailymot...')
#4 /usr/share/umsp/umsp-test.php(38): _callPlugin('umsp/dailymotio...', 'plugin=dailymot...')
#5 {main}


I guess there is a problem when getting the XML and the script gets an incomplete, or invalid XML file from time to time...
User avatar
mad_ady
Developer
 
Posts: 3002
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Next

Return to UMSP Plugins

Who is online

Users browsing this forum: No registered users and 4 guests