pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

solution: Auto-delete from source after transfer to Tivo

 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks
 View previous topic :: View next topic  
Author Message
imatt



Joined: 21 Aug 2008
Posts: 8

PostPosted: Tue Mar 23, 2010 2:46 pm    Post subject: solution: Auto-delete from source after transfer to Tivo Reply with quote

I know for me personally this is ideal - a torrent catcher dumps shows automatically to a computer, and they are deleted once I transfer them to the TIVO - making a nearly maintenance-free setup.

From another thread:
imatt wrote:
Does the "clear" button on the remote pass a code that can be captured when browsing a PC share?


wmcbrine wrote:
No, HMO doesn't work that way.


Although I couldn't get pytivo to delete via a remote control command, I did set it up to do the next best thing: Delete from the source after a successful transfer. A simple change to the video.py script and now it deletes the file from the computer after a successful upload to the TIVO.

Code:
        elapsed = time.time() - start
        rate = int(count / elapsed) / 1024
        logger.info('[%s] Done sending "%s" to %s, %d bytes, %.2f KBps' %
                    (time.strftime('%d/%b/%Y %H:%M:%S'), fname,
                     tivo_name, count, rate))
        # Delete file after sucessful transfer. Claims "in use" if xfer aborted. MATT
        os.remove(fname)
        logger.info('Deleted "%s" from the computer' % fname)



If the transfer is aborted via the tivo or hitting Q in the pytivo console, the file is still seen as being "in-use" (in windows, anyway, I think by transcode.py) and as a result it will not delete.
Crude, yes. Bad programming practices, definitely. Effective? Very.

Maybe enabling this type of activity as an option from the web UI or config file can be put in future releases?

I used the wcmbrine release: wmcbrine-79ec1693bf877799655612b079f568bc5deafedd.zip from 3-13-2010.
Back to top
View user's profile Send private message
imatt



Joined: 21 Aug 2008
Posts: 8

PostPosted: Tue Mar 23, 2010 7:31 pm    Post subject: Reply with quote

Updated: If files are located in a specific directory they will not be deleted.

Code:

        logger.info('[%s] Done sending "%s" to %s, %d bytes, %.2f KBps' %
                    (time.strftime('%d/%b/%Y %H:%M:%S'), fname,
                     tivo_name, count, rate))
        #-----------------------------------------------------------
        # Delete file after sucessful transfer. Claims "in use" if xfer aborted, so file will not be deleted. MATT
        # The below works properly. Doesn't delete the file if it is inside the dirpath location.
        fullfilepath = fname
        dirpath,filename = os.path.split(fullfilepath)
        if dirpath == 'Y:\keep':
            logger.info('Did not delete file from the computer, was located inside %s' % dirpath)
        else:
            os.remove(fname)
            logger.info('Deleted %s from the computer' % filename)
        #-----------------------------------------------------------
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO

Get pytivo at SourceForge.net. Fast, secure and Free Open Source software downloads
[ Time: 0.1692s ][ Queries: 12 (0.0318s) ][ GZIP on - Debug on ]