]> kaliko git repositories - mpd-sima.git/commitdiff
Add positional argument random, a random mode shortcut
authorkaliko <kaliko@azylum.org>
Thu, 10 Feb 2022 17:12:18 +0000 (18:12 +0100)
committerkaliko <kaliko@azylum.org>
Fri, 28 Oct 2022 06:40:08 +0000 (08:40 +0200)
doc/Changelog
doc/source/index.rst
doc/source/man/mpd-sima.1.rst
sima/launch.py
sima/utils/startopt.py

index b352718918af72902da13dc80b9ef5d99d76be9c..4232d77cd8e1f1503aafe9fe1fbc6675add20705 100644 (file)
@@ -1,3 +1,10 @@
+MPD_sima v0.18.2
+
+  * Add positional argument:
+  "random", a short cut to start in random mode
+
+ -- kaliko <kaliko@azylum.org>  UNRELEASED
+
 MPD_sima v0.18.1
 
  * Remove bad heuristic to infer artist aliases
 MPD_sima v0.18.1
 
  * Remove bad heuristic to infer artist aliases
index a098a5a3afd1eb79075807c6a8d65d9b7f4af3e2..b3dc0d8218a329d48461489b3fcd7dff847e7ca2 100644 (file)
@@ -30,6 +30,13 @@ suggestions but there are other possibilities, see :ref:`configuration-examples`
     mpd-sima --host mpd.example.org
 
 
     mpd-sima --host mpd.example.org
 
 
+**To start in random queuing mode:**
+
+.. code-block:: sh
+
+    # Adds 5 tracks at random when there is only 1 track in the queue
+    mpd-sima random 5
+
 #####################
 User's documentation
 #####################
 #####################
 User's documentation
 #####################
index 5877bdea1a47e36df32b8624f39af99ee214927b..29d10f3cd13f46f54453c76f3a37d76c1c24d4be 100644 (file)
@@ -27,6 +27,8 @@ SYNOPSYS
 
 ``mpd-sima bl-delete id``
 
 
 ``mpd-sima bl-delete id``
 
+``mpd-sima random [nbtracks]``
+
 
 DESCRIPTION
 -----------
 
 DESCRIPTION
 -----------
@@ -154,6 +156,10 @@ Command arguments
    Remove blocklist entry referenced by its id. Use bloclist view
    command to get the id.
 
    Remove blocklist entry referenced by its id. Use bloclist view
    command to get the id.
 
+``random [nbtracks]``
+   Starts in random mode overriding internal plugin configuration. If
+   `nbtracks` is provided, as many tracks will be queued (defaults to one).
+
 ENVIRONMENT
 -----------
 
 ENVIRONMENT
 -----------
 
index 9c31397301316ca57dae50a29f4ab42d18c8bb17..179f1c40be5d62a7b7875f310f53a4bbcb7b8825 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
-# Copyright (c) 2013, 2014, 2015, 2020, 2021 kaliko <kaliko@azylum.org>
+# Copyright (c) 2013, 2014, 2015, 2020-2022 kaliko <kaliko@azylum.org>
 #
 #  This file is part of sima
 #
 #
 #  This file is part of sima
 #
@@ -136,6 +136,10 @@ def start(sopt, restart=False):
                 sys.exit(1)
             SimaDB(db_path=db_file).purge_history(duration=0)
             sys.exit(0)
                 sys.exit(1)
             SimaDB(db_path=db_file).purge_history(duration=0)
             sys.exit(0)
+        if cmd == 'random':
+            config['sima']['internal'] = 'Crop, Random'
+            if sopt.options.get('nbtracks'):
+                config['random']['track_to_add'] = str(sopt.options.get('nbtracks'))
 
     logger.info('Starting (%s)...', info.__version__)
     sima = core.Sima(config)
 
     logger.info('Starting (%s)...', info.__version__)
     sima = core.Sima(config)
index 7f3a5febdb0d91f9fb8e3a439954e233343a2835..c3fb161a67aca583b5907057d974a1d09cf25530 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2009-2015, 2021 kaliko <kaliko@azylum.org>
+# Copyright (c) 2009-2015, 2022 kaliko <kaliko@azylum.org>
 #
 #  This file is part of sima
 #
 #
 #  This file is part of sima
 #
@@ -114,6 +114,10 @@ CMDS = [
             {'name': 'id', 'type': int, 'nargs': '?',
              'help': 'blocklist ID to suppress (use bl-view to list IDs)'}
          ], 'help': 'Remove entries from the blocklist'},
             {'name': 'id', 'type': int, 'nargs': '?',
              'help': 'blocklist ID to suppress (use bl-view to list IDs)'}
          ], 'help': 'Remove entries from the blocklist'},
+        {'random': [
+            {'name': 'nbtracks', 'type': int, 'nargs': '?',
+             'help': 'Number of tracks to add'}
+         ], 'help': 'Start in random auto queuing'},
 ]
 
 
 ]