saintamh

Commit 1146

User picture
  • Author: saintamh
  • 2010-08-22 19:44 (over 3 years ago)

itunes/triage.pl: redefined a bit priorities

Files Affected

 
11451146
18
use warnings;
18
use warnings;
19
use strict;
19
use strict;
20
 
20
 
 
 
21
use Win32::OLE;
 
 
22
 
21
#------------------------------------------------------------------------------
23
#------------------------------------------------------------------------------
22
# constructor
24
# constructor
23
 
25
 
11451146
27
#------------------------------------------------------------------------------
27
#------------------------------------------------------------------------------
28
# includes
28
# includes
29
 
29
 
 
 
30
use iTunes;
 
 
31
 
30
use List::Util qw/sum/;
32
use List::Util qw/sum/;
31
use Win32::OLE;
 
 
32
 
33
 
33
use iTunes;
 
 
34
 
 
 
35
#------------------------------------------------------------------------------
34
#------------------------------------------------------------------------------
36
# config
35
# config
37
 
36
 
...
 
...
 
49
 
48
 
50
# How those translate to priorities
49
# How those translate to priorities
51
sub get_track_priority {
50
sub get_track_priority {
52
    my %track_triage = @_;
51
    my ($track, %track_triage) = @_;
 
 
52
    (my $path = $track->{Location}) =~ s/\\/\//g;
53
 
53
 
54
    if ($track_triage{location} eq 'edi') {
54
    if ($path =~ m!Varia/Speech/!i) {
55
        'P4';
55
        'P4';
 
 
56
    } elsif ($path =~ m!/My Documents/!i) {
 
 
57
        'do not backup';
 
 
58
    } elsif ($path =~ m!(?:Varia/Singles/)!i) {
 
 
59
        'P3';
 
 
60
    } elsif (!$track->{Enabled}) {
 
 
61
        'P4';
 
 
62
    } elsif ($track_triage{location} eq 'edi') {
 
 
63
        'P4';
56
    } elsif ($track_triage{location} eq 'mtl') {
64
    } elsif ($track_triage{location} eq 'mtl') {
57
        if ($track_triage{rarity} eq 'hard') {
65
        if ($track_triage{rarity} eq 'hard') {
58
            'P2';
66
            'P2';
...
 
...
 
122
    }
130
    }
123
 
131
 
124
    # find priority and file in the appropriate queue
132
    # find priority and file in the appropriate queue
125
    my $priority = &get_track_priority (%track_triage);
133
    my $priority = &get_track_priority ($track, %track_triage);
126
    push @{$tracks_by_priority{$priority} ||= []}, $track;
134
    push @{$tracks_by_priority{$priority} ||= []}, $track
 
 
135
        unless ($priority eq 'do not backup');
127
}
136
}
128
 
137
 
129
# save them
138
# save them