~severinh/ubuntu/natty/lottanzb/merge-from-sid

« back to all changes in this revision

Viewing changes to lottanzb/postprocessor.py

  • Committer: Bazaar Package Importer
  • Author(s): Severin Heiniger
  • Date: 2009-01-06 12:54:07 UTC
  • Revision ID: james.westby@ubuntu.com-20090106125407-0p6ko3l0wwjoyr0b
Tags: upstream-0.4.0
ImportĀ upstreamĀ versionĀ 0.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (C) 2008 LottaNZB Development Team
 
4
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; version 3.
 
8
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 
 
18
import sys
 
19
 
 
20
from shutil import move
 
21
from os.path import join, dirname
 
22
 
 
23
from lottanzb.core import App
 
24
from lottanzb.util import _
 
25
 
 
26
App().load_config()
 
27
 
 
28
success = sys.argv[1] == "SUCCESS"
 
29
archive_name = sys.argv[2]
 
30
dest_dir = sys.argv[3]
 
31
elapsed_time = sys.argv[4]
 
32
 
 
33
#if len(sys.argv) == 6:
 
34
#       par_message = sys.argv[5] 
 
35
 
 
36
separator = App().config.plugins.categories.separator
 
37
 
 
38
try:
 
39
    category, name = archive_name.split(separator)
 
40
except ValueError:
 
41
    pass
 
42
else:
 
43
    if not success:
 
44
        category = _("Failed")
 
45
    
 
46
    move(dest_dir, join(dirname(dest_dir), category, name))