Browse the code
| Differences between 112 and 113 on /. | |||||||
|---|---|---|---|---|---|---|---|
| Number of edited files: | 6 (1 added, 0 deleted and 5 modified) | ||||||
| Author: | kaliko | ||||||
| Log message: | * update documentation * fix stupid typo/bug |
||||||
| Date: | 2009-07-02 18:35:02 | ||||||
|
|||||||
| Old | New | Code |
|---|---|---|
| 1 | 1 |
sima v0.3.0 |
| 2 | 2 | |
| 3 |
* manage user's own database for similar artists trought a new conf file | |
| 4 |
user_db_cfg. Refer to examples for syntax. | |
| 3 | 5 |
* check playlist queue to add tracks, not only history. |
| 4 | 6 |
* Rename history history.pkl |
| 5 | 7 |
* add new command line options |
| 6 | 8 |
| Old | New | Code |
|---|---|---|
| 6 | 6 |
* Now create configuration file looking for available environment variables |
| 7 | 7 |
MPD_HOST and MPD_PORT. |
| 8 | 8 |
* add --version|-v and --help|-h command line options |
| 9 |
* possibility to add user's similar artist to add to last.fm replies | |
| 9 | 10 | |
| 10 | ||
| 11 | 11 |
| Old | New | Code |
|---|---|---|
| 86 | 86 | |
| 87 | 87 |
DESCRIPTION - advanced use |
| 88 | 88 |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
| 89 |
The commented file "mpd_sima.cfg.example" (in examples directory) | |
| 89 |
The commented file <mpd_sima.cfg.example> (in examples directory)
| |
| 90 | 90 |
present all defaults values for options in both mandatory and optional |
| 91 | 91 |
sections on the configuration file. Optional sections give you some |
| 92 | 92 |
more control over MPD_sima core behaviour. Here follows a description |
| 100 | 100 |
be defined in the configuration file (mpd_sima.cfg) otherwise the |
| 101 | 101 |
default values will be used: |
| 102 | 102 | |
| 103 |
track_to_add = 2 | |
| 103 |
track_to_add = 1
| |
| 104 | 104 |
queue_length = 2 |
| 105 | 105 | |
| 106 | 106 |
MPD_sima is controlling MPD's state regularly, the "main_loop_time" |
| 129 | 129 |
efficient way to refresh only modified entries (cf. audioscrobbler |
| 130 | 130 |
library). Hence, once created, the cache will remain unchanged. |
| 131 | 131 | |
| 132 |
USER CACHE | |
| 132 |
USER DB
| |
| 133 | 133 |
The user cache allows you to associate similar artists to a specific |
| 134 | 134 |
artist following you own musical taste. File syntax is described in |
| 135 | 135 |
examples directory. |
| 136 |
In order to activate it, set up "user_db = True" and fill user_db.cfg to | |
| 137 |
suits your needs. For this file specific syntax please refer to the file | |
| 138 |
<user_db.cfg.example> (in examples directory). | |
| 136 | 139 | |
| 137 |
CACHE & HISTORY files. | |
| 140 |
CACHE, HISTORY & USER_DB files.
| |
| 138 | 141 |
Cache and history files are saved to standard directory $XDG_DATA_HOME, |
| 139 | 142 |
if not set the default $HOME/.local/share/ is used. |
| 140 | 143 |
History and cache file are saved only if respective option are set to |
| 142 | 145 |
SIGINT (2, a.k.a. interrupt from keyboard / CTRL-C). |
| 143 | 146 |
History : $XDG_DATA_HOME/mpd_sima/history.pkl |
| 144 | 147 |
Cache : $XDG_DATA_HOME/mpd_sima/similar_cache.pkl |
| 145 |
User Cache : $XDG_CONFIG_HOME/mpd_sima/usr_cache.cfg | |
| 148 |
User_DB : $XDG_CONFIG_HOME/mpd_sima/usr_db.cfg
| |
| 146 | 149 | |
| 147 | 150 | |
| 148 | 151 |
FEED BACK |
| 149 | 152 |
| Old | New | Code |
|---|---|---|
| 1 |
#b###################################################################### | |
| 1 |
######################################################################## | |
| 2 | 2 |
# |
| 3 | 3 |
# If you need special settings, rename this file as mpd_sima.cfg within |
| 4 | 4 |
# your $XDG_CONFIG_HOME (default is $HOME/.config/mpd_sima/) |
| 13 | 13 | |
| 14 | 14 |
########################## MANDATORY SECTION ########################## |
| 15 | 15 |
# |
| 16 |
# | |
| 16 |
## MPD ## | |
| 17 | 17 |
[MPD] |
| 18 |
## HOST # type: string | |
| 18 | 19 |
host = localhost |
| 20 |
## PORT # type: decimal string | |
| 19 | 21 |
port = 6600 |
| 22 |
## PASSWORD # type: boolean | |
| 20 | 23 |
# password is optional, a warning will raise though |
| 21 | 24 |
password = false |
| 22 | 25 | |
| 30 | 33 |
# But well you got bored of the way MPD_sima is behaving, well then go ahead |
| 31 | 34 |
# play with it :) |
| 32 | 35 | |
| 33 |
#LOGGING FACILITY | |
| 36 |
## LOGGING FACILITY ##
| |
| 34 | 37 |
[log] |
| 35 | 38 |
# message are logged to console |
| 36 | 39 |
# |
| 37 |
## VERBOSITY: | |
| 40 |
## VERBOSITY # type: string (within a list)
| |
| 38 | 41 |
# verbosity in : debug, info, warning, error |
| 39 | 42 |
# default if not specify is "info" |
| 40 |
# *DEBUG LEVEL WILL PRINT OUT YOUR PASSWORD* | |
| 43 |
# *DEBUG LEVEL WILL PRINT OUT YOUR MPD PASSWORD*
| |
| 41 | 44 |
verbosity = info |
| 42 | 45 |
## |
| 43 | 46 | |
| 44 | 47 |
#CORE |
| 45 | 48 |
[sima] |
| 46 |
# These settings deal with MPD_sima core behaviour. | |
| 49 |
# These settings deal with MPD_sima core behaviour. | |
| 47 | 50 |
# |
| 48 |
## HISTORY: | |
| 51 |
## USER_DB # type: boolean
| |
| 52 |
# Load user database to find similar artists | |
| 53 |
# User DB is loaded from $XDG_CONFIG_HOME/mpd_sima/user_db.cfg | |
| 54 |
user_db = False | |
| 55 | ||
| 56 |
## HISTORY # type: boolean | |
| 49 | 57 |
# keep history between sessions (pickle/unpickle history) |
| 50 | 58 |
# to forget history remove $XDG_DATA_HOME/mpd_sima/add_history.pkl |
| 51 | 59 |
# value: True | False |
| 52 | 60 |
history = False |
| 53 |
## CACHE: | |
| 61 | ||
| 62 |
## CACHE # type: boolean
| |
| 54 | 63 |
# … |
| 55 | 64 |
# to reset cache remove $XDG_DATA_HOME/mpd_sima/similar_cache.pkl |
| 56 |
# value: True | False | |
| 57 | 65 |
cache = False |
| 58 |
## | |
| 66 | ||
| 67 |
## QUEUE_LENGTH # type: decimal string
| |
| 59 | 68 |
# Missing Description… |
| 60 | 69 |
queue_length = 2 |
| 70 | ||
| 71 |
## TRACK_TO_ADD # type: decimal string | |
| 72 |
# Missing Description… | |
| 61 | 73 |
track_to_add = 1 |
| 62 |
## | |
| 63 |
# | |
| 64 |
## MAIN_LOOP_TIME | |
| 65 |
# time pause between two checks in seconds | |
| 66 |
# (less than 2~3 seconds IS useless) | |
| 74 | ||
| 75 |
## MAIN_LOOP_TIME # type: decimal string
| |
| 76 |
# time pause in seconds between two checks | |
| 77 |
# (less than 2~3 seconds IS USELESS) | |
| 67 | 78 |
main_loop_time = 4 |
| 68 | 79 | |
| 69 | 80 |
# |
| 70 | 81 |
| Old | New | Code |
|---|---|---|
| 500 | 500 |
# then USR_DB.items('artist') returns:
|
| 501 | 501 |
# [ ('similar artist name 0',''), ('similar artist name 0','')]
|
| 502 | 502 |
# |
| 503 |
if CONFIG.getboolean('sima', 'usr_cache'):
| |
| 503 |
if CONFIG.getboolean('sima', 'user_db'):
| |
| 504 | 504 |
SIMA_LOGGER.info('Loading user DB from: %s' % CONF_MANAGER.user_cache)
|
| 505 | 505 |
try: |
| 506 | 506 |
USR_DB = load_usr_cache(CONF_MANAGER.user_cache) |
| 507 | 507 |
MPD_sima

