Advertisement
Guest User

Untitled

a guest
Jan 26th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #######################################################################
  2. #
  3. #    Push Service for Enigma-2
  4. #    Coded by betonme (c) 2012 <glaserfrank(at)gmail.com>
  5. #    Support: http://www.i-have-a-dreambox.com/wbb2/thread.php?threadid=167779
  6. #
  7. #    This program is free software; you can redistribute it and/or
  8. #    modify it under the terms of the GNU General Public License
  9. #    as published by the Free Software Foundation; either version 2
  10. #    of the License, or (at your option) any later version.
  11. #
  12. #    This program is distributed in the hope that it will be useful,
  13. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #    GNU General Public License for more details.
  16. #
  17. #######################################################################
  18.  
  19. # Config
  20. from Components.config import ConfigYesNo, ConfigText, ConfigNumber, NoSave
  21.  
  22. # Plugin internal
  23. from Plugins.Extensions.PushService.__init__ import _
  24. from Plugins.Extensions.PushService.ControllerBase import ControllerBase
  25.  
  26. # Plugin specific
  27. import os
  28.  
  29.  
  30. # Constants
  31.  
  32. SUBJECT = _("Found CrashLog(s)")
  33.  
  34.  
  35.  
  36.  
  37. class ListDirTest(ControllerBase):
  38.  
  39.     ForceSingleInstance = True
  40.  
  41.     def __init__(self):
  42.         # Is called on instance creation
  43.         ControllerBase.__init__(self)
  44.         self.movielist= []
  45.  
  46.         # Default configuration
  47.         self.setOption( 'path',     NoSave(ConfigText(   default = "/media/hdd/movie/", fixed_size = False )), _("Where to check") )
  48.  
  49.  
  50.     def run(self, callback, errback):
  51.         # At the end a plugin has to call one of the functions: callback or errback
  52.         # Callback should return with at least one of the parameter: Header, Body, Attachment
  53.         # If empty or none is returned, nothing will be sent
  54.         path = self.getValue('path')
  55.         movielist = []
  56.         for file in os.listdir( path ):
  57.             if file.endswith(".ts"):
  58.                 movielist.append(file)
  59.         body = "Meine Filme: \n" + "\n".join(movielist)
  60.         #body = _("Found CrashLog(s)")
  61.         callback( SUBJECT, body )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement