x2c 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +103 -0
- data/x2c/config.rb +59 -0
- data/x2c/core/args.rb +36 -0
- data/x2c/core/client.rb +61 -0
- data/x2c/core/collection.rb +136 -0
- data/x2c/core/configure.rb +43 -0
- data/x2c/core/meta.rb +77 -0
- data/x2c/core/prompt.rb +59 -0
- data/x2c/core/resulteval.rb +133 -0
- data/x2c/doc.rb +243 -0
- data/x2c/doc/Array/cdesc-Array.yaml +21 -0
- data/x2c/doc/Array/format-i.yaml +10 -0
- data/x2c/doc/Array/inspect-i.yaml +10 -0
- data/x2c/doc/Array/to_s-i.yaml +10 -0
- data/x2c/doc/Fixnum/cdesc-Fixnum.yaml +20 -0
- data/x2c/doc/Fixnum/hour-i.yaml +12 -0
- data/x2c/doc/Fixnum/min-i.yaml +12 -0
- data/x2c/doc/Fixnum/sec-i.yaml +12 -0
- data/x2c/doc/Hash/cdesc-Hash.yaml +21 -0
- data/x2c/doc/Hash/format-i.yaml +10 -0
- data/x2c/doc/Hash/inspect-i.yaml +10 -0
- data/x2c/doc/Hash/to_s-i.yaml +10 -0
- data/x2c/doc/Help/cdesc-Help.yaml +30 -0
- data/x2c/doc/Help/help-c.yaml +10 -0
- data/x2c/doc/Help/help_hacks-c.yaml +10 -0
- data/x2c/doc/Help/ignore-c.yaml +10 -0
- data/x2c/doc/Help/irb_help-c.yaml +10 -0
- data/x2c/doc/Help/match%3f-c.yaml +10 -0
- data/x2c/doc/Help/trace_help-c.yaml +10 -0
- data/x2c/doc/IRB/ExtendCommandBundle/cdesc-ExtendCommandBundle.yaml +15 -0
- data/x2c/doc/IRB/Prompt/%5b%5d-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/cdesc-Prompt.yaml +36 -0
- data/x2c/doc/IRB/Prompt/config-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/main%3d-i.yaml +12 -0
- data/x2c/doc/IRB/Prompt/new-c.yaml +10 -0
- data/x2c/doc/IRB/Prompt/pop-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/push-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/set-i.yaml +11 -0
- data/x2c/doc/IRB/Prompt/start-i.yaml +10 -0
- data/x2c/doc/IRB/cdesc-IRB.yaml +15 -0
- data/x2c/doc/Kernel/cdesc-Kernel.yaml +16 -0
- data/x2c/doc/Kernel/xmms-i.yaml +12 -0
- data/x2c/doc/NilClass/cdesc-NilClass.yaml +16 -0
- data/x2c/doc/NilClass/inspect-i.yaml +10 -0
- data/x2c/doc/Object/cdesc-Object.yaml +18 -0
- data/x2c/doc/Object/format-i.yaml +10 -0
- data/x2c/doc/Object/to_d-i.yaml +12 -0
- data/x2c/doc/Prompting/activate-i.yaml +12 -0
- data/x2c/doc/Prompting/back-i.yaml +12 -0
- data/x2c/doc/Prompting/cdesc-Prompting.yaml +45 -0
- data/x2c/doc/Prompting/gointo-i.yaml +12 -0
- data/x2c/doc/Prompting/inspect-i.yaml +12 -0
- data/x2c/doc/Prompting/intersect-i.yaml +12 -0
- data/x2c/doc/Prompting/last%3d-i.yaml +12 -0
- data/x2c/doc/Prompting/last-i.yaml +12 -0
- data/x2c/doc/Prompting/lost-i.yaml +12 -0
- data/x2c/doc/Prompting/makelast-i.yaml +12 -0
- data/x2c/doc/Prompting/pop-i.yaml +12 -0
- data/x2c/doc/Prompting/push-i.yaml +12 -0
- data/x2c/doc/Prompting/stack-i.yaml +12 -0
- data/x2c/doc/Prompting/to_s-i.yaml +12 -0
- data/x2c/doc/Prompting/union-i.yaml +12 -0
- data/x2c/doc/String/cdesc-String.yaml +18 -0
- data/x2c/doc/String/format-i.yaml +10 -0
- data/x2c/doc/String/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Browse/%5b%5d-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/cd-i.yaml +17 -0
- data/x2c/doc/Xmms/Browse/cdesc-Browse.yaml +34 -0
- data/x2c/doc/Xmms/Browse/dirs-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/files-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Browse/get-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/list-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/mlib_add-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/open-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/cdesc-Chains.yaml +39 -0
- data/x2c/doc/Xmms/Client/Chains/info-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/song-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Config/cdesc-Config.yaml +18 -0
- data/x2c/doc/Xmms/Client/Config/config-i.yaml +18 -0
- data/x2c/doc/Xmms/Client/Daemon/cdesc-Daemon.yaml +27 -0
- data/x2c/doc/Xmms/Client/Daemon/connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Daemon/dead_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/post_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/pre_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/start_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/cdesc-IPlayback.yaml +22 -0
- data/x2c/doc/Xmms/Client/IPlayback/pause-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/skip-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/ListNames/cdesc-ListNames.yaml +20 -0
- data/x2c/doc/Xmms/Client/ListNames/setup_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/ListNames/setup_lists-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Mlib/browse-i.yaml +14 -0
- data/x2c/doc/Xmms/Client/Mlib/cdesc-Mlib.yaml +20 -0
- data/x2c/doc/Xmms/Client/Mlib/rehash-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/cdesc-Remember.yaml +25 -0
- data/x2c/doc/Xmms/Client/Remember/gointo-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Remember/push-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Search/cdesc-Search.yaml +17 -0
- data/x2c/doc/Xmms/Client/Shortcut/cdesc-Shortcut.yaml +22 -0
- data/x2c/doc/Xmms/Client/Shortcut/now-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Shortcut/seek-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Shortcut/volume-i.yaml +14 -0
- data/x2c/doc/Xmms/Client/Vote/cdesc-Vote.yaml +24 -0
- data/x2c/doc/Xmms/Client/Vote/rating-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/remove_rating%21-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/undo_voting-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/vote-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/__connect-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/async_start-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/bindata_add-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/bindata_retrieve-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/c-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/cdesc-Client.yaml +169 -0
- data/x2c/doc/Xmms/Client/coll_find-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_idlist_from_playlist_file-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_query_ids-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_query_info-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_rename-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_save-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configure-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_register-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_set-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/continue-i.yaml +11 -0
- data/x2c/doc/Xmms/Client/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/handled_connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/help-i.yaml +16 -0
- data/x2c/doc/Xmms/Client/main-c.yaml +12 -0
- data/x2c/doc/Xmms/Client/main_stats-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/medialib_add_entry-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_property_remove-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_property_set-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_remove-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_get_id-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_get_info-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_path_import-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_rehash-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_select-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/new-c.yaml +12 -0
- data/x2c/doc/Xmms/Client/on_disconnect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/playback_pause-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_ms-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_ms_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_samples-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_samples_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_start-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_stop-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_tickle-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_volume_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_volume_set-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playbacklist-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/playlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_set_next-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_set_next_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/plugin_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/post_connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/pre_connect-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/quit-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/setup-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/showprompt-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/shutdown-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/welcome-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/xform_media_browse-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/%26-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%5b%5d%3d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%5b%5d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%7c-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%7e-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/add-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/cdesc-Attributes.yaml +25 -0
- data/x2c/doc/Xmms/Collection/Attributes/field-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/field_string-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Attributes/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Chains/cdesc-Chains.yaml +39 -0
- data/x2c/doc/Xmms/Collection/Chains/list-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/load-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/load_form_file-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/playlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/save-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/FormQuery/cdesc-FormQuery.yaml +22 -0
- data/x2c/doc/Xmms/Collection/FormQuery/method_missing-i.yaml +14 -0
- data/x2c/doc/Xmms/Collection/Info/cdesc-Info.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Info/info-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Info/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Operands/cdesc-Operands.yaml +18 -0
- data/x2c/doc/Xmms/Collection/Operands/empty%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%3c%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%3e%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%7e-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/_-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Query/cdesc-Query.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Query/exist%3f-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Query/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/has-i.yaml +13 -0
- data/x2c/doc/Xmms/Collection/Query/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/acceptable-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/awesome-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/cdesc-Vote.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Vote/good-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/nice-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/notsucking-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/unvoted-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/and-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/attribute-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/cdesc-Collection.yaml +140 -0
- data/x2c/doc/Xmms/Collection/complement-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/default-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/idlis-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/idlist%3d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/intersect-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/load-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/new_constructor-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_list-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_pshuffle-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_selection-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/not-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/operand-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/or-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/parent-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/pshuffle-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/queue-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/tree_inject-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/tree_walk-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/typ-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/union-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/universe-c.yaml +12 -0
- data/x2c/doc/Xmms/Config/%5b%5d%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/%5b%5d-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/cdesc-Config.yaml +47 -0
- data/x2c/doc/Xmms/Config/configs-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/join-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/keys-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/methods-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Config/parent-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/respond_to%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/subs-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/subtrees-i.yaml +10 -0
- data/x2c/doc/Xmms/Duration/cdesc-Duration.yaml +25 -0
- data/x2c/doc/Xmms/Duration/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Duration/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Duration/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/cdesc-Format.yaml +22 -0
- data/x2c/doc/Xmms/Format/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/cdesc-Info.yaml +32 -0
- data/x2c/doc/Xmms/Info/count-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Info/search-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Media/cdesc-Media.yaml +31 -0
- data/x2c/doc/Xmms/Media/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Media/media-i.yaml +12 -0
- data/x2c/doc/Xmms/Media/mlib_add-i.yaml +12 -0
- data/x2c/doc/Xmms/Media/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Media/parent-i.yaml +12 -0
- data/x2c/doc/Xmms/Options/%5b%5d%3d-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/%5b%5d-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/cdesc-Options.yaml +24 -0
- data/x2c/doc/Xmms/Options/get_argv-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/help-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/opts-c.yaml +10 -0
- data/x2c/doc/Xmms/Playlist/Chains/cdesc-Chains.yaml +18 -0
- data/x2c/doc/Xmms/Playlist/Chains/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/add-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/cdesc-Shortcut.yaml +24 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/insert-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/move-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/remove_entries-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/add_collection-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/add_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/cdesc-Playlist.yaml +56 -0
- data/x2c/doc/Xmms/Playlist/clear-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/collection-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/current_pos-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/entries-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Playlist/insert_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/load-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/name-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/new-c.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/playlist_move_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/radd-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/remove_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/shuffle-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/sort-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/cdesc-Mlib.yaml +30 -0
- data/x2c/doc/Xmms/PropDict/Mlib/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/Mlib/methods-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/Mlib/rehash-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/remove%21-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/respond_to%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/cdesc-PropDict.yaml +27 -0
- data/x2c/doc/Xmms/PropDict/format-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/id-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/to_h-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Remember/cdesc-Remember.yaml +18 -0
- data/x2c/doc/Xmms/Result/cdesc-Result.yaml +20 -0
- data/x2c/doc/Xmms/Result/val-i.yaml +12 -0
- data/x2c/doc/Xmms/Song/cdesc-Song.yaml +29 -0
- data/x2c/doc/Xmms/Song/format-c.yaml +12 -0
- data/x2c/doc/Xmms/Song/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Song/info-i.yaml +10 -0
- data/x2c/doc/Xmms/Song/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/Chains/cdesc-Chains.yaml +29 -0
- data/x2c/doc/Xmms/Songlist/Chains/idlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/Chains/queue-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/cdesc-Songlist.yaml +37 -0
- data/x2c/doc/Xmms/Songlist/collection-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/format_hash-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/info_hash-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/songs-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/cdesc-Xmms.yaml +18 -0
- data/x2c/doc/Xmms/save_call-c.yaml +12 -0
- data/x2c/doc/created.rid +1 -0
- data/x2c/plug/async.rb +50 -0
- data/x2c/plug/chains.rb +148 -0
- data/x2c/plug/config.rb +90 -0
- data/x2c/plug/daemon.rb +72 -0
- data/x2c/plug/format.rb +251 -0
- data/x2c/plug/help.rb +240 -0
- data/x2c/plug/info.rb +86 -0
- data/x2c/plug/iplayback.rb +49 -0
- data/x2c/plug/listnames.rb +43 -0
- data/x2c/plug/mlib.rb +128 -0
- data/x2c/plug/query.rb +51 -0
- data/x2c/plug/remember.rb +124 -0
- data/x2c/plug/shortcuts.rb +108 -0
- data/x2c/plug/tutorial.rb +134 -0
- data/x2c/plug/vote.rb +77 -0
- data/x2c/x2c +36 -0
- data/x2c/x2c.rb +16 -0
- metadata +453 -0
data/x2c/plug/config.rb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
|
2
|
+
|
|
3
|
+
module Xmms
|
|
4
|
+
# The Config Class is used as an interface to the configuration of the deamon
|
|
5
|
+
# use config.subtree to show value, or config.subfield = <val> to set it
|
|
6
|
+
# normal you start to browse the config by calling the config method on the client,
|
|
7
|
+
# afterwords you can just go into subtrees by typing there name and get back with
|
|
8
|
+
# the parent config
|
|
9
|
+
class Config
|
|
10
|
+
attr_reader :root
|
|
11
|
+
def initialize root=nil
|
|
12
|
+
@root=root
|
|
13
|
+
end
|
|
14
|
+
def configs
|
|
15
|
+
xmms.configval_list.reject do |k,v|
|
|
16
|
+
@root && !(k.to_s =~ /^#{@root}/)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
def subs
|
|
20
|
+
configs.map{|k,v| k.to_s.sub(/^#{@root}\./,'')}
|
|
21
|
+
end
|
|
22
|
+
def keys
|
|
23
|
+
subs.reject{|s| s.include?('.')}
|
|
24
|
+
end
|
|
25
|
+
def subtrees
|
|
26
|
+
subs.map{|s| s.include?('.') && s.split('.').first}.compact.uniq
|
|
27
|
+
end
|
|
28
|
+
def join *keys
|
|
29
|
+
"#{@root ? @root+'.' : ''}#{keys.join('.')}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def [] key
|
|
33
|
+
if keys.include?(key.to_s)
|
|
34
|
+
xmms.configval_get(join(key))
|
|
35
|
+
else
|
|
36
|
+
Xmms::Config.new(join(key))
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
def []= key, val
|
|
40
|
+
puts " #{join(key)}"
|
|
41
|
+
xmms.configval_set(join(key), val.to_s)
|
|
42
|
+
end
|
|
43
|
+
def parent
|
|
44
|
+
r=@root.split('.')[0..-2] if @root
|
|
45
|
+
Xmms::Config.new(r && !r.empty? && r.join('.'))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
alias_method :__respond_to?, :respond_to?
|
|
49
|
+
alias_method :__methods, :methods
|
|
50
|
+
def respond_to? id
|
|
51
|
+
__respond_to?(id) || (subtrees+keys+keys.map{|k| "#{k}="}).include?(id.to_s)
|
|
52
|
+
end
|
|
53
|
+
def methods
|
|
54
|
+
__methods + subtrees + keys + keys.map{|k| "#{k}="}
|
|
55
|
+
end
|
|
56
|
+
def method_missing id,*args
|
|
57
|
+
if id.to_s[-1] == ?=
|
|
58
|
+
id = id.to_s[0..-2]
|
|
59
|
+
self[id] = args.first.to_s
|
|
60
|
+
else
|
|
61
|
+
self[id]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
include Format rescue nil
|
|
66
|
+
include Prompting rescue nil
|
|
67
|
+
def format idt=' '
|
|
68
|
+
(subtrees.map{|s| s ? "#{s} ->" : "parent <-"} +
|
|
69
|
+
keys.map{|k| "#{k} = '#{self[k]}'"}.sort).format(idt)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
class Client
|
|
73
|
+
# the config plugin just adds the config method.
|
|
74
|
+
# with the help of the remember plugin, you will get a nice interface to the config
|
|
75
|
+
module Config
|
|
76
|
+
# returns a config object. it will show its subtrees and key-value paris
|
|
77
|
+
# if you have the remember module, you can simply walk deeper into the tree:
|
|
78
|
+
# >> config
|
|
79
|
+
# >> output
|
|
80
|
+
# afterwrods you can set values. beacause key=value would set local variables, use something like this
|
|
81
|
+
# >> last.buffersize = 1337
|
|
82
|
+
# >> last['buffersize']= 1337
|
|
83
|
+
# >> config.output.buffersize = 1337
|
|
84
|
+
def config
|
|
85
|
+
Xmms::Config.new
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
include Config
|
|
89
|
+
end
|
|
90
|
+
end
|
data/x2c/plug/daemon.rb
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
|
2
|
+
module Xmms
|
|
3
|
+
class Client
|
|
4
|
+
module Daemon
|
|
5
|
+
Options['start-daemon' => [true, 'start the daemon, if x2c can\'t connect'],
|
|
6
|
+
'auto-daemon' => [false, 'force to start daemon']]
|
|
7
|
+
attr_reader :log
|
|
8
|
+
# called berfore before starting daemon
|
|
9
|
+
def pre_daemon; end
|
|
10
|
+
# called after connected to stated daemon
|
|
11
|
+
def post_daemon(path); end
|
|
12
|
+
# called when deamon dies
|
|
13
|
+
def dead_daemon; end
|
|
14
|
+
# starts the daemon
|
|
15
|
+
def start_daemon
|
|
16
|
+
puts "... starting deamon"
|
|
17
|
+
@log = Array.new
|
|
18
|
+
path = 'unix:///tmp/xmms-ipc'
|
|
19
|
+
client = Thread.current
|
|
20
|
+
Xmms.save_call{pre_daemon}
|
|
21
|
+
daemon = Thread.new do
|
|
22
|
+
File.popen('echo & setsid xmms2d 2>&1 &','r') do |f|
|
|
23
|
+
begin
|
|
24
|
+
path = f.each_line do |l|
|
|
25
|
+
@log.push l.chomp!
|
|
26
|
+
break $1 if l =~ /IPC listening on '(.*)'/
|
|
27
|
+
end
|
|
28
|
+
ensure
|
|
29
|
+
client.wakeup
|
|
30
|
+
end
|
|
31
|
+
f.each_line do |l|
|
|
32
|
+
if @log.length > 40
|
|
33
|
+
@log.pop
|
|
34
|
+
end
|
|
35
|
+
@log.push l.chomp!
|
|
36
|
+
end
|
|
37
|
+
puts "\n... deamon stoped running"
|
|
38
|
+
daemon = false
|
|
39
|
+
Xmms.call_save{dead_daemon}
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
sleep
|
|
43
|
+
begin
|
|
44
|
+
handled_connect(path)
|
|
45
|
+
Xmms.save_call{post_daemon(path) if daemon}
|
|
46
|
+
puts "... connected #{path}"
|
|
47
|
+
rescue ClientError => e
|
|
48
|
+
puts "\n... #{path}: #{e}"
|
|
49
|
+
exit 1
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
def connect; end
|
|
53
|
+
end
|
|
54
|
+
include Daemon
|
|
55
|
+
def connect path=Options['xmms-path']
|
|
56
|
+
if Options['auto-daemon']
|
|
57
|
+
start_daemon
|
|
58
|
+
else
|
|
59
|
+
begin
|
|
60
|
+
handled_connect(path)
|
|
61
|
+
rescue ClientError => e
|
|
62
|
+
if Options['start-daemon']
|
|
63
|
+
start_daemon
|
|
64
|
+
else
|
|
65
|
+
puts "\n... #{path}: #{e}"
|
|
66
|
+
exit 1
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
data/x2c/plug/format.rb
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
|
2
|
+
|
|
3
|
+
# Definitions for the formtion of common xmms classes
|
|
4
|
+
# It will try to show visaul nice resuals for the command line client
|
|
5
|
+
# The output will get improved if the client.rb module is loaded
|
|
6
|
+
# by giving the modules acces to a the xmms function
|
|
7
|
+
module Xmms
|
|
8
|
+
# The format module is used to show results in a cool way.
|
|
9
|
+
# you can overwright the format method to get a custom autoput
|
|
10
|
+
module Format
|
|
11
|
+
def to_s
|
|
12
|
+
' '+format
|
|
13
|
+
end
|
|
14
|
+
def inspect
|
|
15
|
+
' '+format
|
|
16
|
+
end
|
|
17
|
+
def format idt=' '
|
|
18
|
+
"<#{self.class}:#{self.object_id}>"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
class ::Object
|
|
22
|
+
def format idt=' '
|
|
23
|
+
to_s
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
class ::String
|
|
27
|
+
def inspect; ' '+format end
|
|
28
|
+
def format idt=' '
|
|
29
|
+
self.gsub(/\n/,"\n"+idt)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
class ::NilClass
|
|
33
|
+
def inspect; ' kk' end
|
|
34
|
+
end
|
|
35
|
+
class ::Array
|
|
36
|
+
include Format
|
|
37
|
+
def to_s; ' '+format end
|
|
38
|
+
def inspect; ' '+format end
|
|
39
|
+
def format idt=' '
|
|
40
|
+
self.map{|v| v.format(idt)}.join("\n"+idt)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
class ::Hash
|
|
44
|
+
include Format
|
|
45
|
+
def to_s; ' '+format end
|
|
46
|
+
def inspect; ' '+format end
|
|
47
|
+
def format idt=' '
|
|
48
|
+
keys = Hash.new
|
|
49
|
+
max = self.keys.map do |k|
|
|
50
|
+
keys[k] = k.format(idt)
|
|
51
|
+
keys[k].length
|
|
52
|
+
end.max
|
|
53
|
+
self.to_a.map do |k,v|
|
|
54
|
+
keys[k] + ' ' * (max-keys[k].length) + " => " + v.format(idt+' '*(max))
|
|
55
|
+
end.format(idt)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class Result
|
|
60
|
+
alias_forward :to_s, :val
|
|
61
|
+
alias_forward :inspect, :val
|
|
62
|
+
alias_forward :format, :val
|
|
63
|
+
end
|
|
64
|
+
class Collection
|
|
65
|
+
class Query
|
|
66
|
+
include Format
|
|
67
|
+
def format idt=' '
|
|
68
|
+
idt=idt.sub(/ /,'!!')
|
|
69
|
+
"Medialib-Query-Constructor-Class based on \n"+
|
|
70
|
+
"#{idt+' '}#{@base.format(idt+' ')}\n"+
|
|
71
|
+
"#{idt}waiting for a specification of the field #{@field.format(idt)}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
class Attributes
|
|
75
|
+
include Format
|
|
76
|
+
def format idt=' '
|
|
77
|
+
self.map do |k,v|
|
|
78
|
+
"#{k}:#{v}"
|
|
79
|
+
end.join(' ')
|
|
80
|
+
end
|
|
81
|
+
def field_string
|
|
82
|
+
field.to_a.join(":")
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
include Format
|
|
87
|
+
# you don't want to change this, but you could
|
|
88
|
+
def format ident=' '
|
|
89
|
+
self.tree_inject(self.name || 'collection',0) do |a,d,c|
|
|
90
|
+
idt = ident+" "*(d+1)
|
|
91
|
+
a + "\n" + ident + " "*d + case c.type
|
|
92
|
+
when Collection::TYPE_IDLIST ; ": "+Songlist.new(idlist).to_s
|
|
93
|
+
when Collection::TYPE_REFERENCE ; c.operands.empty? ? "[ universe ]" : ">>"
|
|
94
|
+
when Collection::TYPE_COMPLEMENT ; "!"
|
|
95
|
+
when Collection::TYPE_INTERSECTION ; "&"
|
|
96
|
+
when Collection::TYPE_UNION ; "|"
|
|
97
|
+
when Collection::TYPE_EQUALS ; "= #{c.attributes.field_string}"
|
|
98
|
+
when Collection::TYPE_MATCH ; "~ #{c.attributes.field_string}"
|
|
99
|
+
when Collection::TYPE_GREATER ; "> #{c.attributes.field_string}"
|
|
100
|
+
when Collection::TYPE_SMALLER ; "< #{c.attributes.field_string}"
|
|
101
|
+
when Collection::TYPE_HAS ; "E #{c.attributes.field_string}"
|
|
102
|
+
when Collection::TYPE_QUEUE ; "] #{c.attributes.format}\n#{idt}"+Songlist.new(idlist).to_s
|
|
103
|
+
when Collection::TYPE_PARTYSHUFFLE ;
|
|
104
|
+
q = (c["upcomming"]||c["size"]||10).to_i
|
|
105
|
+
p = (c["position"].to_i||0).to_i
|
|
106
|
+
p = 0 if p=1
|
|
107
|
+
"% #{p}+#{q} " + Songlist.new(idlist).to_s
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
class Playlist
|
|
114
|
+
include Format
|
|
115
|
+
def format idt=' '
|
|
116
|
+
head = begin collection.format(idt)
|
|
117
|
+
rescue Client::DisconnectedError; "" end
|
|
118
|
+
|
|
119
|
+
now = begin; current_pos.val
|
|
120
|
+
rescue Result::ValueError; -1 end
|
|
121
|
+
pos = -1
|
|
122
|
+
h = entries.format_hash
|
|
123
|
+
head + "\n" + entries.map do |i|
|
|
124
|
+
idt[0..4] = (((pos+=1)==now ? '>%3i' : '%4i') % pos)
|
|
125
|
+
idt + h[i.to_i]
|
|
126
|
+
end.join("\n")
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
class PropDict
|
|
130
|
+
include Format
|
|
131
|
+
def inspect; ' '+format end
|
|
132
|
+
def to_s; ' '+format end
|
|
133
|
+
def format idt=nil
|
|
134
|
+
to_h.format
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
class Client
|
|
138
|
+
include Format
|
|
139
|
+
# overwrite this method in config.rb to cusotmize the status line
|
|
140
|
+
def format idt=' '
|
|
141
|
+
p = case playback_status.val
|
|
142
|
+
when PLAY ; '>>'
|
|
143
|
+
when PAUSE ; '||'
|
|
144
|
+
when STOP ; '[]'
|
|
145
|
+
else ; "<#{s.to_s}>"
|
|
146
|
+
end rescue "<error in clientstatus: #{$!}>"
|
|
147
|
+
id = begin
|
|
148
|
+
playback_current_id.val
|
|
149
|
+
rescue Result::ValueError
|
|
150
|
+
-1
|
|
151
|
+
end
|
|
152
|
+
t = playback_playtime/1000
|
|
153
|
+
|
|
154
|
+
r = "%i#{t>600 ? '':':'}%02i" % [t/60,t%60]
|
|
155
|
+
i = "%9i" % id
|
|
156
|
+
i[0..r.length-1] = r
|
|
157
|
+
"#{i} #{p}"
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
class Song
|
|
162
|
+
include Format
|
|
163
|
+
# overwrite this method in config.rb to cusotmize list output
|
|
164
|
+
def self.format info, max=nil
|
|
165
|
+
return self.class.name unless max
|
|
166
|
+
# get info and length info
|
|
167
|
+
id,dur,art,ttl,alb,tnr,rate = [:id,:duration,:artist,:title,:album,:tracknr,:rating].map{|f| info[f]}
|
|
168
|
+
aspace,lspace,skip = [:artist,:tilum, :album].map{|f| max[f]}
|
|
169
|
+
# format for title (album tr)
|
|
170
|
+
tnr = tnr ? "%3i" % tnr+')' : ') '
|
|
171
|
+
alb = alb ? '('+alb+tnr : ''
|
|
172
|
+
# scale it up, at least to fill 80 chars
|
|
173
|
+
lspace+= 7 unless skip == 0
|
|
174
|
+
if aspace + lspace < 55
|
|
175
|
+
aspace = [20,55-lspace].min if aspace < 20
|
|
176
|
+
lspace = 55 - aspace
|
|
177
|
+
end
|
|
178
|
+
lspace-= alb.length
|
|
179
|
+
# put it all in the string
|
|
180
|
+
"%5i %#{aspace}s - %-#{lspace}s%s%7s %s" % [id,art,ttl,alb,dur.format,rate]
|
|
181
|
+
end
|
|
182
|
+
def format idt=' '
|
|
183
|
+
Songlist.new(xmms.playlist.entries.val.map{|v| v.to_i} + [@id]).format_hash[@id].format(idt)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
class Songlist
|
|
187
|
+
include Format
|
|
188
|
+
def to_s
|
|
189
|
+
state = nil
|
|
190
|
+
fst = -1
|
|
191
|
+
@ids.inject('') do |acc,snd|
|
|
192
|
+
acc += if(fst+1==snd)
|
|
193
|
+
state ? "" : (state="..")
|
|
194
|
+
else
|
|
195
|
+
(state ? (state=nil;fst.to_s) : '') + ':' + snd.to_s
|
|
196
|
+
end
|
|
197
|
+
fst = snd; acc
|
|
198
|
+
end + (state ? @ids.last.to_s : '')+": => #{@ids.length}"
|
|
199
|
+
end
|
|
200
|
+
def info_hash
|
|
201
|
+
info = xmms.coll_query_info(collection,
|
|
202
|
+
['id','artist','title','album','duration','tracknr','date','genre',
|
|
203
|
+
'mine','url','comment','rating','vote_count']).val
|
|
204
|
+
max = Hash.new(0)
|
|
205
|
+
ids = Hash.new
|
|
206
|
+
info.reverse!.map! do |h|
|
|
207
|
+
id = h[:id]
|
|
208
|
+
next nil if ids[id]
|
|
209
|
+
ids[id] = true
|
|
210
|
+
# guess some values, to extract all the info
|
|
211
|
+
url = File.basename(h[:url]).split('-',2).map{|s| s.gsub(/\+/,' ').gsub(/\.\w{3,5}/,'')}
|
|
212
|
+
h[:artist] ||= url.first
|
|
213
|
+
h[:title] ||= url.last
|
|
214
|
+
h[:rating] = "#{h[:rating]||'-'}/#{h[:vote_count]||0}"
|
|
215
|
+
h[:duration] = h[:duration] ? Duration.new(h[:duration]) : Duration.new(0)
|
|
216
|
+
h[:arlum] = h[:artist].to_s + h[:album].to_s
|
|
217
|
+
h[:tilum] = h[:title].to_s + h[:album].to_s
|
|
218
|
+
h.each_pair do |field,val|
|
|
219
|
+
val.replace(val.gsub(/\(.*\)/,'').gsub(/^ | $/,'')) if val.is_a?(String)
|
|
220
|
+
length = val ? val.to_s.length : 0
|
|
221
|
+
max[field] = length if length > max[field]
|
|
222
|
+
end
|
|
223
|
+
end.compact!
|
|
224
|
+
return info,max
|
|
225
|
+
end
|
|
226
|
+
def format_hash
|
|
227
|
+
info, max = info_hash
|
|
228
|
+
ret = Hash.new
|
|
229
|
+
info.each do |h|
|
|
230
|
+
ret[h[:id]] = Song.format h,max
|
|
231
|
+
end
|
|
232
|
+
ret
|
|
233
|
+
end
|
|
234
|
+
def format idt=nil
|
|
235
|
+
if idt
|
|
236
|
+
to_s
|
|
237
|
+
else
|
|
238
|
+
idt = ' '
|
|
239
|
+
h = format_hash
|
|
240
|
+
@ids.map{|i| h[i]}.join("\n#{idt}") + "\n#{idt}=> "+to_s
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
class Duration
|
|
245
|
+
include Format
|
|
246
|
+
def format idt=' '
|
|
247
|
+
d = @val/1000
|
|
248
|
+
"%i:%02i" % [d/60, d%60]
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
data/x2c/plug/help.rb
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# This is based on the magic_help.rb file form tow.
|
|
2
|
+
# neither I found any Licnece nor contact to the writer,
|
|
3
|
+
# but hopefully I'm allowed to use it. all credit goes to him,
|
|
4
|
+
# whoever he is. The only thing I got is this website:
|
|
5
|
+
# http://taw.chaosforge.org/magic_help/
|
|
6
|
+
|
|
7
|
+
require 'irb'
|
|
8
|
+
require 'irb/extend-command'
|
|
9
|
+
require 'rdoc/ri/ri_driver'
|
|
10
|
+
|
|
11
|
+
module IRB::ExtendCommandBundle # :nodoc:
|
|
12
|
+
@ALIASES.delete_if{|a| a == [:help, :irb_help, NO_OVERRIDE]}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module Help
|
|
16
|
+
class Xmms::Client
|
|
17
|
+
# Help will show you autogenerated ri help on Functions and objects.
|
|
18
|
+
# It can be called with either a block, an Object or a String argument.
|
|
19
|
+
# Wenn called with an Object, it will show help on the objects Class.
|
|
20
|
+
# Strings arguments are simply look up inside the ri System.
|
|
21
|
+
# If you call it with a block, it will try to give you docomentation
|
|
22
|
+
# about what the block does. Here are some examples for that:
|
|
23
|
+
#
|
|
24
|
+
# >> help skip => help on Xmms::Result
|
|
25
|
+
# >> help 'skip' => help on Xmms::Client#skip
|
|
26
|
+
# >> help {skip} => help on Xmms::Client#skip
|
|
27
|
+
#
|
|
28
|
+
# >> help 'artist' => help on Xmms::PropDict#artist
|
|
29
|
+
# >> help {artist} => help on Xmms::Collection::method_missing
|
|
30
|
+
#
|
|
31
|
+
# >> help 'Chains' => no help
|
|
32
|
+
# >> help Chains => help on Xmms::Client::Chains
|
|
33
|
+
# >> help {Chains} => help on Xmms::Client::Chains
|
|
34
|
+
#
|
|
35
|
+
# >> help Collection::Chains => help on Xmms::Collection::Chains
|
|
36
|
+
# >> help 'Collection::Chains' => no help
|
|
37
|
+
# >> help {Collection::Chains} => help on Xmms::Collection::Chains
|
|
38
|
+
#
|
|
39
|
+
# So, most often you want to use {}, because it the help on what would be done.
|
|
40
|
+
def help *args, &block
|
|
41
|
+
Help.help *args, &block
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
argv = ::ARGV.dup
|
|
48
|
+
::ARGV.clear
|
|
49
|
+
begin
|
|
50
|
+
ENV['RI'] = "--format plain --no-pager
|
|
51
|
+
--doc-dir #{File.join(Xmms::X2C_ROOT,'doc')} --system --gems --site"
|
|
52
|
+
@@ri = RiDriver.new
|
|
53
|
+
rescue
|
|
54
|
+
puts $!
|
|
55
|
+
ENV['RI'] = "--format plain --no-pager --system --gems --site"
|
|
56
|
+
@@ri = RiDriver.new
|
|
57
|
+
end
|
|
58
|
+
::ARGV<< argv
|
|
59
|
+
::ARGV.flatten!
|
|
60
|
+
|
|
61
|
+
def self.irb_help topic
|
|
62
|
+
begin
|
|
63
|
+
@@ri.get_info_for topic
|
|
64
|
+
rescue RiError => e
|
|
65
|
+
puts "!! #{e}"
|
|
66
|
+
puts "!! either you help query is not accessable"
|
|
67
|
+
puts "!! or perhaps you have to generate the doc in you install dir"
|
|
68
|
+
puts "!!"
|
|
69
|
+
end
|
|
70
|
+
topic
|
|
71
|
+
end
|
|
72
|
+
def self.help_hacks(m, res=nil)
|
|
73
|
+
if res and m == "Kernel#method_missing"
|
|
74
|
+
m = res unless res =~ /\A(?:.*)(?:\#|::|\.)method_missing\Z/
|
|
75
|
+
elsif res and (m =~ /\A(.*)\#new\Z/ or m =~ /\A(.*)::new\Z/)
|
|
76
|
+
cls = $1
|
|
77
|
+
if res =~ /\A(.*)(::|\.)new\Z/
|
|
78
|
+
cls_requested, k = $1, $2
|
|
79
|
+
m = "#{cls_requested}::new" unless cls == cls_requested
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
if m =~ /\AKernel(\#|::|\.)([^\#\:\.]+)\Z/
|
|
83
|
+
k, mn = $1, $2
|
|
84
|
+
exceptions = ["singleton_method_added", "remove_instance_variable", "singleton_method_removed", "singleton_method_undefined"]
|
|
85
|
+
correctly_located_docs = Kernel.private_instance_methods - exceptions
|
|
86
|
+
unless correctly_located_docs.include?(mn)
|
|
87
|
+
m = "Object#{k}#{mn}"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
m
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@@ignore ||= Hash.new
|
|
96
|
+
def self.ignore klass, hash
|
|
97
|
+
@@ignore[klass] = (@@ignore[klass] || Hash.new).merge hash
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def Help.match? chain, klass, func
|
|
101
|
+
return nil unless chain
|
|
102
|
+
return chain[klass][func] if(chain[klass] and chain[klass][func])
|
|
103
|
+
klass.included_modules.find do |k|
|
|
104
|
+
if(chain[k] and chain[k][func])
|
|
105
|
+
break chain[k][func]
|
|
106
|
+
end
|
|
107
|
+
end or
|
|
108
|
+
klass.class == Module && chain.keys.find do |k|
|
|
109
|
+
if(k.include?(klass) and chain[k][func])
|
|
110
|
+
break chain[k][func]
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
def Help.trace_help
|
|
115
|
+
skipstack = []
|
|
116
|
+
chainstack = []
|
|
117
|
+
argument_error = nil
|
|
118
|
+
catch(:magic_help_topic) do
|
|
119
|
+
set_trace_func proc{ |event, file, line, id, binding, klass|
|
|
120
|
+
id = id.to_sym
|
|
121
|
+
case event
|
|
122
|
+
when /return/
|
|
123
|
+
# wait till we get out of error handling and return topic of error-throwing function
|
|
124
|
+
if argument_error && !skipstack.last
|
|
125
|
+
argument_error = nil
|
|
126
|
+
throw(:magic_help_topic,[klass,id])
|
|
127
|
+
end
|
|
128
|
+
while skipstack.last == [klass,id]
|
|
129
|
+
skipstack.pop
|
|
130
|
+
end
|
|
131
|
+
while chainstack.last and chainstack.last[0,1] == [klass,id]
|
|
132
|
+
chainstack.pop
|
|
133
|
+
end
|
|
134
|
+
when /call/
|
|
135
|
+
match = Help.match?(chainstack.last && chainstack.last.last, klass, id) ||
|
|
136
|
+
Help.match?(@@ignore, klass, id)
|
|
137
|
+
if match
|
|
138
|
+
case match
|
|
139
|
+
when :skip
|
|
140
|
+
when :over
|
|
141
|
+
skipstack.push [klass,id]
|
|
142
|
+
when Hash
|
|
143
|
+
chainstack.push [klass,id,{klass => match}]
|
|
144
|
+
end
|
|
145
|
+
elsif [klass,id] == [Kernel,:send]
|
|
146
|
+
elsif [klass,id] == [Kernel,:set_trace_func]
|
|
147
|
+
elsif [klass,id] == [Class,:new]
|
|
148
|
+
# skip argument errors
|
|
149
|
+
if eval("self", binding) == ArgumentError
|
|
150
|
+
argument_error = true
|
|
151
|
+
skipstack.push [klass,id]
|
|
152
|
+
end
|
|
153
|
+
elsif skipstack.last
|
|
154
|
+
else
|
|
155
|
+
throw(:magic_help_topic,[klass,id])
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
}
|
|
159
|
+
begin
|
|
160
|
+
yield
|
|
161
|
+
ensure
|
|
162
|
+
set_trace_func nil
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def self.help(*args,&block)
|
|
168
|
+
raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" if args.size > 1
|
|
169
|
+
raise ArgumentError, "help cannot take both arguments and block" if args.size > 0 and block_given?
|
|
170
|
+
|
|
171
|
+
if block
|
|
172
|
+
res_mm = trace_help(&block)
|
|
173
|
+
query = if res_mm.is_a?(Array) and
|
|
174
|
+
res_mm.length == 2 and
|
|
175
|
+
res_mm.first.is_a?(Module) and
|
|
176
|
+
res_mm.last.is_a?(Symbol)
|
|
177
|
+
klass, meth = *res_mm
|
|
178
|
+
if(klass.to_s == 'NameError::message')
|
|
179
|
+
query='this function'
|
|
180
|
+
else
|
|
181
|
+
help_hacks("#{klass}##{meth}")
|
|
182
|
+
end
|
|
183
|
+
else
|
|
184
|
+
if res_mm.is_a?(Module)
|
|
185
|
+
res_mm.to_s
|
|
186
|
+
else
|
|
187
|
+
res_mm.class.to_s
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
return irb_help(query)
|
|
191
|
+
elsif !args.empty?
|
|
192
|
+
res = args[0]
|
|
193
|
+
else
|
|
194
|
+
res = "Xmms::Client#help"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
query = case res
|
|
198
|
+
when Module
|
|
199
|
+
res.to_s
|
|
200
|
+
when UnboundMethod, Method
|
|
201
|
+
help_method_extract(res)
|
|
202
|
+
when /\A(.*)(#|::|\.)(.*)\Z/
|
|
203
|
+
cp, k, m = $1, $2, $3
|
|
204
|
+
begin
|
|
205
|
+
c = cp.split(/::/).inject(Object){|c, path_elem| c.const_get(path_elem) }
|
|
206
|
+
case k
|
|
207
|
+
when "#"
|
|
208
|
+
m = c.instance_method(m)
|
|
209
|
+
m = help_method_extract(m)
|
|
210
|
+
when "::"
|
|
211
|
+
m = c.method(m)
|
|
212
|
+
m = help_method_extract(m)
|
|
213
|
+
m = m.sub(/\#/, "::") if c == Class && m == "Class#new"
|
|
214
|
+
when "."
|
|
215
|
+
begin
|
|
216
|
+
m = c.instance_method(m)
|
|
217
|
+
rescue NameError
|
|
218
|
+
m = c.method(m)
|
|
219
|
+
end
|
|
220
|
+
m = help_method_extract(m)
|
|
221
|
+
end
|
|
222
|
+
help_hacks(m, res)
|
|
223
|
+
rescue NameError
|
|
224
|
+
res
|
|
225
|
+
end
|
|
226
|
+
when String
|
|
227
|
+
res
|
|
228
|
+
else
|
|
229
|
+
res.class.to_s
|
|
230
|
+
end
|
|
231
|
+
irb_help query
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def self.help_method_extract(m) # :nodoc:
|
|
235
|
+
unless m.inspect =~ %r[\A#<(?:Unbound)?Method: (.*?)>\Z]
|
|
236
|
+
raise "Cannot parse result of #{m.class}#inspect: #{m.inspect}"
|
|
237
|
+
end
|
|
238
|
+
$1.sub(/\A.*?\((.*?)\)(.*)\Z/){ "#{$1}#{$2}" }.sub(/\./, "::").sub(/#<Class:(.*?)>#/) { "#{$1}::" }
|
|
239
|
+
end
|
|
240
|
+
end
|