librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1635] Set up parsing of --just-finished argument to o


From: Daniel Watkins
Subject: [Librefm-commits] [1635] Set up parsing of --just-finished argument to offline-submit.py.
Date: Fri, 15 May 2009 19:41:00 +0000

Revision: 1635
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1635
Author:   odd_bloke
Date:     2009-05-15 19:40:59 +0000 (Fri, 15 May 2009)
Log Message:
-----------
Set up parsing of --just-finished argument to offline-submit.py.

Modified Paths:
--------------
    trunk/scripts/offline-submit.py

Modified: trunk/scripts/offline-submit.py
===================================================================
--- trunk/scripts/offline-submit.py     2009-05-15 17:25:54 UTC (rev 1634)
+++ trunk/scripts/offline-submit.py     2009-05-15 19:40:59 UTC (rev 1635)
@@ -22,14 +22,26 @@
 if __name__ == '__main__':
     usage = "%prog [--server <SERVER>] <USERNAME> <START TIME> <MEDIA FILES>"
     parser = get_parser(usage=usage)
+    parser.add_option('-j', '--just-finished', action="store_true",
+                      help="Works out START TIME as if you've just finished"
+                           " listening to MEDIA FILES.  START TIME argument"
+                           " will be treated as a media file, so don't pass"
+                           " it.")
+    parser.set_defaults(just_finished=False)
     opts,args = parser.parse_args()
-    if len(args) < 3:
+    if opts.just_finished:
+        expected_args = 2
+    else:
+        expected_args = 3
+    if len(args) < expected_args:
         parser.error("All arguments are required.")
 
-    username,start_string = args[:2]
+    username = args.pop(0)
+    if not opts.just_finished:
+        start_string = args.pop(0)
     server = opts.server
     password = getpass.getpass()
-    tracks = args[2:]
+    tracks = args
     server = GobbleServer(server, username, password)
 
     dt = _parse_date(start_string)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]