Ryan Roth wrote:
> I should of put a disclaimer on that.  This is the patch I use to
> accomplish running commands before and after a video.
> 
> 
>> --- videoitem.py        2006-11-25 17:11:58.000000000 -0800
>> +++ videoitem.py.old    2006-11-25 17:03:55.000000000 -0800
>> @@ -388,15 +388,8 @@
>>
>>      def play(self, arg=None, menuw=None, alternateplayer=False):
>>          """
>> -       execute commands if defined
>> -       """
>> -        if config.VIDEO_PRE != '':
>> -            os.system( config.VIDEO_PRE )
>> -
>> -       """
>>          play the item.
>>          """
>> -
>>          if not self.possible_player:
>>              for p in plugin.getbyname(plugin.VIDEO_PLAYER, True):
>>                  rating = p.rate(self) * 10
>> @@ -529,12 +522,6 @@
>>
>>      def stop(self, arg=None, menuw=None):
>>          """
>> -        execute commands if defined
>> -        """
>> -        if config.VIDEO_PRE != '':
>> -            os.system( config.VIDEO_POST )
>> -
>> -       """
>>          stop playing
>>          """
>>          if self.player:
>>
>>
>> SourceForge.net wrote:
>>  
>>> Feature Requests item #1602956, was opened at 2006-11-26 01:03
>>> Message generated for change (Tracker Item Submitted) made by Item
>>> Submitter
>>> You can respond by visiting:
>>> https://sourceforge.net/tracker/?func=detail&atid=446898&aid=1602956&group_id=46652
>>>
>>>
>>> Please note that this message will contain a full copy of the comment
>>> thread,
>>> including the initial issue submission, for this request,
>>> not just the latest update.
>>> Category: None
>>> Group: None
>>> Status: Open
>>> Priority: 5
>>> Private: No
>>> Submitted By: ryan (ryanroth)
>>> Assigned to: Nobody/Anonymous (nobody)
>>> Summary: Run commands PRE and POST of viewing a video
>>>
>>> Initial Comment:
>>> I would like the ability to run commands defined in local_conf.py
>>> before and after the viewing of a video.
>>>
>>> I use this feature to run X10 commands before and after watching a
>>> movie to dim and brighten the lights.  It is a real neat feature and
>>> a big wow factor when people come over and watch movies.
>>>
>>> I currently have hacked the code directly into Freevo in a ugly
>>> fashion.  Every time I update Freevo I have to rehack it.  I do not
>>> know Python well enough to write this plugin.
>>>
>>> Currently I run the command in the section below line 389 of
>>> video_item.py which is the area where the play commands are issued. 
>>> I'm not sure if this is the best area to have it though.
>>>
>>> My idea for local_conf.py would to have options like the following:
>>>
>>> PRE_VIDEO = ('command to run here')
>>> POST_VIDEO = ('command to run here')
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> You can respond by visiting:
>>> https://sourceforge.net/tracker/?func=detail&atid=446898&aid=1602956&group_id=46652
>>>
>>>
>>> -------------------------------------------------------------------------
>>>
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>> share your
>>> opinions on IT & business topics through brief surveys - and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>
>>> _______________________________________________
>>> Freevo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/freevo-devel
>>>
>>>       
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>> share your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Freevo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freevo-devel
>>
>>   
> 
> ------------------------------------------------------------------------
> 
> --- videoitem.py      2006-11-25 17:11:58.000000000 -0800
> +++ videoitem.py.old  2006-11-25 17:03:55.000000000 -0800
> @@ -388,15 +388,8 @@
>  
>      def play(self, arg=None, menuw=None, alternateplayer=False):
>          """
> -     execute commands if defined
> -     """
> -        if config.VIDEO_PRE != '':
> -            os.system( config.VIDEO_PRE )
> -
> -     """
>          play the item.
>          """
> -
>          if not self.possible_player:
>              for p in plugin.getbyname(plugin.VIDEO_PLAYER, True):
>                  rating = p.rate(self) * 10
> @@ -529,12 +522,6 @@
>  
>      def stop(self, arg=None, menuw=None):
>          """
> -        execute commands if defined
> -        """
> -        if config.VIDEO_PRE != '':
> -            os.system( config.VIDEO_POST )
> -
> -     """
>          stop playing
>          """
>          if self.player:

First many thanks for the patch, interesting application. The changes
are now in rel-1 svn.

Do you mind if I make some comments about this patch?

Please don't use tabs, four spaces is the freevo standard
The patch was reversed, you need to do diff -Nau <old> <new> or better
still use svn diff.
The last part of the patch I think you meant if config.VIDEO_POST:

See: http://freevo.sourceforge.net/cgi-bin/doc/Contributing for more info.

Index: src/video/videoitem.py
===================================================================
--- src/video/videoitem.py      (revision 8611)
+++ src/video/videoitem.py      (working copy)
@@ -388,6 +388,11 @@

     def play(self, arg=None, menuw=None, alternateplayer=False):
         """
+        execute commands if defined
+        """
+        if config.VIDEO_PRE_PLAY:
+            os.system( config.VIDEO_PRE_PLAY )
+        """
         play the item.
         """
         if not self.possible_player:
@@ -522,6 +527,12 @@

     def stop(self, arg=None, menuw=None):
         """
+        execute commands if defined
+        """
+        if config.VIDEO_POST_PLAY:
+            os.system( config.VIDEO_POST_PLAY )
+
+        """
         stop playing
         """
         if self.player:



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to