Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#913 closed Enhancement (wontfix)

option to make fully downloaded files readonly vs. unwanted sparse scrap files

Reported by: jidanni Owned by:
Priority: Low Milestone: None Set
Component: Transmission Version: 1.11
Severity: Normal Keywords:
Cc:

Description

Gentlemen, I propose that there be an option to cause the permissions of a file to be changed to readonly (Unix chmod 444) upon an individual file's download completion.

It would be a big help to those of us who checkmark individual files for downloading, instead of downloading whole torrents.

You see, that way one could differentiate between unwated incomplete "sparse" files (the partial uncheckmarked neighbors of checkmarked files, see Bug # 532) vs. wanted full files.

You see, when one's download is complete, even fancy formulas like

find ${Z?} -type f -iname \*.mp3 -printf '%S\t%s\t%p\n'|sort -nr| tee /dev/stderr|perl -F
t -anwle 'use warnings FATAL => q(all); if((abs(1-$F[0]))<.1){s@.*/@@;die $! unless link $F[2],"candidates/$_"}'

can't exactly differentiate the two types of files.

Change History (6)

comment:1 Changed 14 years ago by livings124

  • Priority changed from High to Low

comment:2 Changed 14 years ago by livings124

  • Resolution set to wontfix
  • Status changed from new to closed

This feels very hacky and bloaty. Marking as read-only will just make deletion more annoying.

comment:3 Changed 14 years ago by jidanni

OK, I have made this script instead. By the way, it would be neat if your bug system sent mail to me at jidanni@… like bugzilla does when something changes.

#!/usr/bin/perl
# transmission-info -- dump transmission(1) torrents'
# "download" and "priority" setting for use _outside_ the GUI.
# E.g., to get a list of the files I marked for download.
# Depends: libbtutil-utils for bt_showmetainfo
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : Dan Jacobson http://jidanni.org/
# Created On      : Mon Jun  2 01:53:53 2008
# Last Modified On: Mon Jun  2 06:05:49 2008
# Update Count    : 147
#Usage example: $0 ~/.config/transmission/resume/*|sed /^1/d
#shows all execpt files not marked for download
use strict;
use warnings FATAL => 'all';
for (@ARGV) {
    die "No such file: $_" unless -f;
    my $resume = $_;
    s/resume$/torrent/ or die "All arguments must be .resume files";
    s@[^/]+$@../torrents/$&@;
    die "No corresponding file: $_" unless -f;
    my $torrent = $_;
    open RESUME, $resume or die "can't open $resume: $!";
    my %h;
    ##I have reverse engineered the RESUME file!:
    while (<RESUME>) {
        for ( split /:/ ) {
            if (/^(dndl|priorityl)/) {
                my $tmp = $1;
                s/$tmp//;
                $h{$tmp} = [/i(-?\d)e/g];
            }
        }
    }
    close RESUME;
    my $bt_showmetainfo = `bt_showmetainfo "$torrent"`;
    my $i               = 0;
    ##prepend the download (0=checked,1=unchecked)
    ##and priority (1=high,0=normal,-1=low) settings:
    $bt_showmetainfo =~ s/^ /$h{dndl}[$i]." ".$h{priorityl}[$i++]/mge;
    print $bt_showmetainfo;
}

comment:4 Changed 14 years ago by jidanni

OK, I discovered I can use native transmissioncli facilities instead of bt_showmetainfo. The bottom part becomes

    my $metainfo = `transmissioncli --info "$torrent"`;
    my $i               = 0;
    ##prepend the download (0=checked,1=unchecked)
    ##and priority (1=high,0=normal,-1=low) settings:
    $metainfo =~ s/^\t(?!announce)/$h{dndl}[$i]." ".$h{priorityl}[$i++]." "/mge;# if /\nfile/m..eof;
    print $metainfo;

comment:5 Changed 14 years ago by jidanni

Another idea might be to have the incomplete files be UNIX "dotfiles", with the dot being removed upon each of their completions.

But that might make things harder for the transmission program to manage internally. So I'll stick with my above scripts.

comment:6 Changed 14 years ago by jidanni

Another perhaps easier scheme is to have two trees per downloaded torrent, the dot tree corresponds to the current way transmission stores files. The non-dot tree contains only HARDLINKS to completed member files. E.g., the user didn't request (checkmark) Goo, so it isn't linked:

Nordsbergs
`-- Greatest Hits
    |-- Bla
.Nordsbergs
`-- Greatest Hits
    |-- Bla
    `-- Goo

But what if we still did complete Goo as it fit inside a downloaded chunk. Should it still be linked? Hmmm.

Wait. Maybe MS-DOS or Windows doesn't have hardlinks, only UNIX. Then maybe use softlinks, or maybe sorry, bye.

Note: See TracTickets for help on using tickets.