"trash-original-torrent-files" doesn't work in daemon mode

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
pukakk
Posts: 4
Joined: Fri Feb 10, 2012 1:43 am

"trash-original-torrent-files" doesn't work in daemon mode

Post by pukakk »

"trash-original-torrent-files" option doesn't work in daemon-mode.

I have found that this problem is caused by not using TR_PREFS_KEY_TRASH_ORIGINAL key in daemon.c

Code: Select all

static void
onFileAdded( tr_session * session, const char * dir, const char * file )
{
    char * filename = tr_buildPath( dir, file, NULL );
    tr_ctor * ctor = tr_ctorNew( session );
    int err = tr_ctorSetMetainfoFromFile( ctor, filename );

    if( !err )
    {
        tr_torrentNew( ctor, &err );

        if( err == TR_PARSE_ERR )
            tr_err( "Error parsing .torrent file \"%s\"", file );
        else
        {
            bool trash = false;
            int test = tr_ctorGetDeleteSource( ctor, &trash );

            tr_inf( "Parsing .torrent file successful \"%s\"", file );

            if( !test && trash )
            {
                tr_inf( "Deleting input .torrent file \"%s\"", file );
                if( remove( filename ) )
                    tr_err( "Error deleting .torrent file: %s", tr_strerror( errno ) );
            }
            else
            {
                char * new_filename = tr_strdup_printf( "%s.added", filename );
                rename( filename, new_filename );
                tr_free( new_filename );
            }
        }
    }

    tr_ctorFree( ctor );
    tr_free( filename );
}
daemon.c has set just "bool trash = false", instead of using TR_PREFS_KEY_TRASH_ORIGINAL key from settings.json
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by gunzip »

pukakk wrote:"trash-original-torrent-files" option doesn't work in daemon-mode.
yes i'm seeing the same bug (regression) with latest nightly transmission-daemon 2.42+ .you should file a ticket here:

http://trac.transmissionbt.com/newticket

where it's more likely to get attention from the developers. the fact that you have already done the detective work will definitely help the matter.

Edit -------------------

quoting from the wiki https://trac.transmissionbt.com/wiki/Ed ... Files#Misc

trash-original-torrent-files: Boolean (default = false) Delete torrents added from the watch directory.

so it only applies to torrents added in the watch directory. so sorry, i guess it's not a real bug.
pukakk
Posts: 4
Joined: Fri Feb 10, 2012 1:43 am

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by pukakk »

quoting from the wiki https://trac.transmissionbt.com/wiki/Ed ... Files#Misc

trash-original-torrent-files: Boolean (default = false) Delete torrents added from the watch directory.

so it only applies to torrents added in the watch directory. so sorry, i guess it's not a real bug.
Man, It doesn't work even while watching directory.

Check it over plz.
cfpp2p
Posts: 290
Joined: Sat Aug 08, 2009 3:14 pm

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by cfpp2p »

??? it works for me, maybe permissions for your watch directory are wrong???

<78>Feb 10 18:35:00 cron[459]: running /opt/bin/msglogbk &>/dev/null
Found new .torrent file "noecho records - atomik buton v2.torrent" in watchdir "/root/watch"
Couldn't read "/root/.config/transmission-daemon/resume/NoEcho records - Atomik Buton v2.87fc09f70ec3c93d.resume": No such file or directory
NoEcho records - Atomik Buton v2 Couldn't read "/root/.config/transmission-daemon/resume/NoEcho records - Atomik Buton v2.87fc09f70ec3c93d.resume"
Saved "/root/.config/transmission-daemon/torrents/NoEcho records - Atomik Buton v2.87fc09f70ec3c93d.torrent"
Parsing .torrent file successful "noecho records - atomik buton v2.torrent"


Deleting input .torrent file "noecho records - atomik buton v2.torrent"


NoEcho records - Atomik Buton v2 Pausing
Saved "/root/.config/transmission-daemon/resume/NoEcho records - Atomik Buton v2.87fc09f70ec3c93d.resume"
NoEcho records - Atomik Buton v2 Announcing to tracker
NoEcho records - Atomik Buton v2 Announcing to tracker
NoEcho records - Atomik Buton v2 Got 1 peers from tracker
NoEcho records - Atomik Buton v2 Scrape successful. Rescraping in 1800 seconds.
NoEcho records - Atomik Buton v2 State changed from "Incomplete" to "Complete"
NoEcho records - Atomik Buton v2 Announcing to tracker
NoEcho records - Atomik Buton v2 Got 2 seeds from tracker
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by gunzip »

pukakk wrote:Man, It doesn't work even while watching directory.

Check it over plz.
OK i checked it again, and it does work perfect for me also for torrents added in watch directory, using transmission-daemon 2.42+ (13218) . And it's documented in my logfile..

Code: Select all

Watching "/home/user1/btornado/tmp/" for new .torrent files (daemon.c:520)
Using inotify to watch directory "/home/user1/btornado/tmp/" (watch.c:73)
Found new .torrent file "Torrent_1.torrent" in watchdir "/home/user1/btornado/tmp/" (watch.c:141)
Saved "/home/user1/.config/transmission-daemon//torrents/Torrent_1.b4e8a4a742e8c026.torrent" (bencode.c:1731)
Torrent_1 Queued for verification (verify.c:260)
Parsing .torrent file successful "Torrent_1.torrent" (daemon.c:250)
Deleting input .torrent file "Torrent_1.torrent" (daemon.c:254)
so as cfpp2p said it might be a permissions problem on your end, check your logfile for some clues.
pukakk
Posts: 4
Joined: Fri Feb 10, 2012 1:43 am

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by pukakk »

gunzip, cfpp2p,
Thanks for your kindly checking. Really thank you, guys.


However, despite your help, my daemon still doesn't delete original torrent files.
This is my syslog, and daemon did just parsing, not deleting.
There is no clue of deleting, even error message of deleting fault("Error deleting .torrent file: %s")

Code: Select all

Feb 11 21:44:52 eugene-HP-ProBook-4321s transmission-daemon[10918]: Found new .torrent file "[isoHunt] Aya Hirai - Kamikaze Premium Vol. 57.torrent" in watchdir "/home/eugene/Temp/" (watch.c:140)
Feb 11 21:44:52 eugene-HP-ProBook-4321s transmission-daemon[10918]: Parsing .torrent file successful "[isoHunt] Aya Hirai - Kamikaze Premium Vol. 57.torrent" (daemon.c:264)
Feb 11 21:47:27 eugene-HP-ProBook-4321s transmission-daemon[10918]: Closing session

And the torrent file's permission is "777" - any user can delete this file.
But, daemon has not even try to delete torrent file.
I have checked log messages concerned with firewall and apparmor, but these tools are unrelated with this case.


What should I do? Where should I check for this problem?
Any advice will help me.
I'll try anything you point out.

I use transmission-daemon 2.42(not nightly builds), on ubuntu 11.04 64 bit system with firewall and apparmor.
pukakk
Posts: 4
Joined: Fri Feb 10, 2012 1:43 am

Re: "trash-original-torrent-files" doesn't work in daemon mo

Post by pukakk »

I got! Thank you all!

The problem is on me! Not daemon.

I modified settings.json while daemon is still running.
So, daemon had not recognized modified option.

Restarting daemon solve the problem.

Thank you
Post Reply