summaryrefslogtreecommitdiff
path: root/apps/scrobbler.c
AgeCommit message (Collapse)Author
2021-04-10misc: Only include rbpaths.h and string-extra.h in places that need itSolomon Peachy
(Don't include rbpaths.h in settings.h, or string-extra.h in rbpaths.h) Build-tested on rocker, erosq, mini2g, nano2g, xduoox3, clipzip, dx50, and uisim Change-Id: If32e9c9910f5c8247a655cb64522b84d6d7ccbb5
2020-10-11hosted: sanitize handling of HOME_DIRSolomon Peachy
* HOME_DIR is now either "/" or special "<HOME>" * target-specific "home dir path" is defined solely by PIVOT_ROOT * PIVOT_ROOT path is now defined in toplevel config files * Make Samsung YP-R0/R1 and SONY_NWZ use PIVOT_ROOT too * Do not prepend PIVOT_ROOT path if the path already has it! * Do not play these games for __PCTOOL__ builds Change-Id: I3d51ad902a5f9cafe45ba15ba654f30f1ec6113a
2020-10-01scrobbler: Fix logfile location on most hosted targets.Solomon Peachy
Change-Id: Ie07fdbd8e99b5c492b87bb5c6a7f916e28143943
2020-07-24[3/4] Completely remove HWCODEC supportSolomon Peachy
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2015-02-02iBasso DX50/DX90: Major code cleanup and reorganization.Udo Schläpfer
Reorganization - Separated iBasso devices from PLATFORM_ANDROID. These are now standlone hosted targets. Most device specific code is in the firmware/target/hosted/ibasso directory. - No dependency on Android SDK, only the Android NDK is needed. 32 bit Android NDK and Android API Level 16. - Separate implementation for each device where feasible. Code cleanup - Rewrite of existing code, from simple reformat to complete reimplementation. - New backlight interface, seperating backlight from touchscreen. - Rewrite of device button handler, removing unneeded code and fixing memory leaks. - New Debug messages interface logging to Android adb logcat (DEBUGF, panicf, logf). - Rewrite of lcd device handler, removing unneeded code and fixing memory leaks. - Rewrite of audiohw device handler/pcm interface, removing unneeded code and fixing memory leaks, enabling 44.1/48kHz pthreaded playback. - Rewrite of power and powermng, proper shutdown, using batterylog results (see http://gerrit.rockbox.org/r/#/c/1047/). - Rewrite of configure (Android NDK) and device specific config. - Rewrite of the Android NDK specific Makefile. Misc - All plugins/games/demos activated. - Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa. Includes - http://gerrit.rockbox.org/r/#/c/993/ - http://gerrit.rockbox.org/r/#/c/1010/ - http://gerrit.rockbox.org/r/#/c/1035/ Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight interface and new option for hold switch, touchscreen, physical button interaction. Rockbox needs the iBasso DX50/DX90 loader for startup, see http://gerrit.rockbox.org/r/#/c/1099/ The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If /mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit gracefully and the loader will restart Rockbox on USB disconnect. Tested on iBasso DX50. Compiled (not tested) for iBasso DX90. Compiled (not tested) for PLATFORM_ANDROID. Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2014-08-30Rewrite filesystem code (WIP)Michael Sevakis
This patch redoes the filesystem code from the FAT driver up to the clipboard code in onplay.c. Not every aspect of this is finished therefore it is still "WIP". I don't wish to do too much at once (haha!). What is left to do is get dircache back in the sim and find an implementation for the dircache indicies in the tagcache and playlist code or do something else that has the same benefit. Leaving these out for now does not make anything unusable. All the basics are done. Phone app code should probably get vetted (and app path handling just plain rewritten as environment expansions); the SDL app and Android run well. Main things addressed: 1) Thread safety: There is none right now in the trunk code. Most of what currently works is luck when multiple threads are involved or multiple descriptors to the same file are open. 2) POSIX compliance: Many of the functions behave nothing like their counterparts on a host system. This leads to inconsistent code or very different behavior from native to hosted. One huge offender was rename(). Going point by point would fill a book. 3) Actual running RAM usage: Many targets will use less RAM and less stack space (some more RAM because I upped the number of cache buffers for large memory). There's very little memory lying fallow in rarely-used areas (see 'Key core changes' below). Also, all targets may open the same number of directory streams whereas before those with less than 8MB RAM were limited to 8, not 12 implying those targets will save slightly less. 4) Performance: The test_disk plugin shows markedly improved performance, particularly in the area of (uncached) directory scanning, due partly to more optimal directory reading and to a better sector cache algorithm. Uncached times tend to be better while there is a bit of a slowdown in dircache due to it being a bit heavier of an implementation. It's not noticeable by a human as far as I can say. Key core changes: 1) Files and directories share core code and data structures. 2) The filesystem code knows which descriptors refer to same file. This ensures that changes from one stream are appropriately reflected in every open descriptor for that file (fileobj_mgr.c). 3) File and directory cache buffers are borrowed from the main sector cache. This means that when they are not in use by a file, they are not wasted, but used for the cache. Most of the time, only a few of them are needed. It also means that adding more file and directory handles is less expensive. All one must do in ensure a large enough cache to borrow from. 4) Relative path components are supported and the namespace is unified. It does not support full relative paths to an implied current directory; what is does support is use of "." and "..". Adding the former would not be very difficult. The namespace is unified in the sense that volumes may be specified several times along with relative parts, e.g.: "/<0>/foo/../../<1>/bar" :<=> "/<1>/bar". 5) Stack usage is down due to sharing of data, static allocation and less duplication of strings on the stack. This requires more serialization than I would like but since the number of threads is limited to a low number, the tradoff in favor of the stack seems reasonable. 6) Separates and heirarchicalizes (sic) the SIM and APP filesystem code. SIM path and volume handling is just like the target. Some aspects of the APP file code get more straightforward (e.g. no path hashing is needed). Dircache: Deserves its own section. Dircache is new but pays homage to the old. The old one was not compatible and so it, since it got redone, does all the stuff it always should have done such as: 1) It may be update and used at any time during the build process. No longer has one to wait for it to finish building to do basic file management (create, remove, rename, etc.). 2) It does not need to be either fully scanned or completely disabled; it can be incomplete (i.e. overfilled, missing paths), still be of benefit and be correct. 3) Handles mounting and dismounting of individual volumes which means a full rebuild is not needed just because you pop a new SD card in the slot. Now, because it reuses its freed entry data, may rebuild only that volume. 4) Much more fundamental to the file code. When it is built, it is the keeper of the master file list whether enabled or not ("disabled" is just a state of the cache). Its must always to ready to be started and bind all streams opened prior to being enabled. 5) Maintains any short filenames in OEM format which means that it does not need to be rebuilt when changing the default codepage. Miscellaneous Compatibility: 1) Update any other code that would otherwise not work such as the hotswap mounting code in various card drivers. 2) File management: Clipboard needed updating because of the behavioral changes. Still needs a little more work on some finer points. 3) Remove now-obsolete functionality such as the mutex's "no preempt" flag (which was only for the prior FAT driver). 4) struct dirinfo uses time_t rather than raw FAT directory entry time fields. I plan to follow up on genericizing everything there (i.e. no FAT attributes). 5) unicode.c needed some redoing so that the file code does not try try to load codepages during a scan, which is actually a problem with the current code. The default codepage, if any is required, is now kept in RAM separarately (bufalloced) from codepages specified to iso_decode() (which must not be bufalloced because the conversion may be done by playback threads). Brings with it some additional reusable core code: 1) Revised file functions: Reusable code that does things such as safe path concatenation and parsing without buffer limitations or data duplication. Variants that copy or alter the input path may be based off these. To do: 1) Put dircache functionality back in the sim. Treating it internally as a different kind of file system seems the best approach at this time. 2) Restore use of dircache indexes in the playlist and database or something effectively the same. Since the cache doesn't have to be complete in order to be used, not getting a hit on the cache doesn't unambiguously say if the path exists or not. Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8 Reviewed-on: http://gerrit.rockbox.org/566 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested: Michael Sevakis <jethead71@rockbox.org>
2014-03-14events: Rework event subsystem (add_event, send_event) to be more versatile.Thomas Martitz
add_event_ex is added that takes an extra user_data pointer. This pointer is passed to the callback (add_event and add_event_ex have slightly different callbacks types). All callbacks also get the event id passed. Events added with add_event_ex must be removed with remove_event_ex because the user_data pointer must match in addition to the callback pointer. On the other add_event is simplified to omit the oneshort parameter which was almost always false (still there with add_event_ex). As a side effect the ata_idle_notify callbacks are changed as well, they do not take a data parameter anymore which was always NULL anyway. This commit also adds some documentation to events.h Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
2013-07-13Get rid of some superfluous single-purpose functions in playback.Michael Sevakis
* Remove explicit tracking of elapsed time of previous track. * Remove function to obtain auto skip flag. * Most playback events now carry the extra information instead and pass 'struct track_event *' for data. * Tweak scrobbler to use PLAYBACK_EVENT_TRACK_FINISH, which makes it cleaner and removes the struct mp3entry. Change-Id: I500d2abb4056a32646496efc3617406e36811ec5
2013-07-12Fix whitespace in files for following commit.Michael Sevakis
Change-Id: I4adb8a152e9b99fcd26d95da7334d7d0cbe2a036
2012-09-11ypr0: Correct .scrobbler.log path for YPR0Sergey Semushin
Change-Id: I74bcb358bb456d7a7958873234f95f04cf2f3643 Reviewed-on: http://gerrit.rockbox.org/310 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2012-06-10Fix checks on buflib allocated handles (0 is not a valid handle value)Bertrik Sikken
Change-Id: I8fdc5a59a5062f40a431cd49971390e21631b8ec
2011-09-07Buflib: Clarification about invalid handlesThomas Martitz
* Enhance allocation function comments to better state the return value and what an invalid value is * Change clients to check for "< 0" instead of "<= 0" or "== 0" * Return -1 or -2 depending on the exact failure in buflib_alloc_ex. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30469 a1c6a512-1295-4272-9138-f99709370657
2011-08-30GSoC/Buflib: Enable compaction in buflib.Thomas Martitz
This enables the ability to allocate (and free) memory dynamically without fragmentation, through compaction. This means allocations can move and fragmentation be reduced. Most changes are preparing Rockbox for this, which many times means adding a move callback which can temporarily disable movement when the corresponding code is in a critical section. For now, the audio buffer allocation has a central role, because it's the one having allocated most. This buffer is able to shrink itself, for which it needs to stop playback for a very short moment. For this, audio_buffer_available() returns the size of the audio buffer which can possibly be used by other allocations because the audio buffer can shrink. lastfm scrobbling and timestretch can now be toggled at runtime without requiring a reboot. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
2011-08-30GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz
The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
2011-08-01Make scrobbler_flush_cache() staticFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30235 a1c6a512-1295-4272-9138-f99709370657
2011-02-15Treat unknown RaaA platforms like SDL for last.FM scrobbler log file. Fix yellowThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29315 a1c6a512-1295-4272-9138-f99709370657
2011-02-15RaaA: Fix last.FM scrobbler log file locationThomas Jarosch
The .scrobbler.log or .scrobbler-timeless.log file resides in the USB mass storage area. The exact location differs for every RaaA platform. The SDL platform sticks it in ROCKBOX_DIR for now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29314 a1c6a512-1295-4272-9138-f99709370657
2010-08-01Rockbox as an application: add get_user_file_path().Thomas Martitz
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox). This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local. On the DAPs it's a no-op, returing /.rockbox directly. Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz
directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Make open() posix compliant api-wise. A few calls (those with O_CREAT) need ↵Thomas Martitz
the additional optional mode parameter so add it. Impact for the core is almost zero, as open() is a wrapper macro for the real open function which doesn't take the variable parameter. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25844 a1c6a512-1295-4272-9138-f99709370657
2009-10-31Fix yellow, againJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23447 a1c6a512-1295-4272-9138-f99709370657
2009-10-31FS#10739: playback.c code splitJeffrey Goode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23444 a1c6a512-1295-4272-9138-f99709370657
2009-10-20Correct wrong usage of event callbacks all over the place. It's not supposed ↵Thomas Martitz
to return anything, and should take a data parameter. Fixing it because correcting the event api prototypes causes many warnings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23301 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts
that, it also introduces sd_*, nand_*, and mmc_*. This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
2008-10-16Accept FS#9480 - centralise and organise the events in the apps/ layer. Jonathan Gordon
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18819 a1c6a512-1295-4272-9138-f99709370657
2008-10-15Split id3.c/h into metadata.c/h and metadata/mp3.c. Updated all references. ↵Björn Stenberg
Moved mp3data.c/h from firmware to apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18814 a1c6a512-1295-4272-9138-f99709370657
2008-10-07FS#9139 - support for ver 1.1 scrobbler log files. Upload any old files ↵Robert Keevil
first - uploading software may need updating, see the LastFMLog wiki page git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18732 a1c6a512-1295-4272-9138-f99709370657
2008-06-28Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg
later. We still need to hunt down snippets used that are not. 1324 modified files... http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-05-28Remove racy call to unregister_ata_idle_func and remove unnecessary check ↵Bertrik Sikken
before calling register_ata_idle_func. Should fix FS#8993 - Freeze on shutting down. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17647 a1c6a512-1295-4272-9138-f99709370657
2008-05-15Protect scrobbler_shutdown against multiple invocations, preventing double ↵Bertrik Sikken
unregister of ata_idle callback. Probable fix for FS#8993 - Freeze on shutting down. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17533 a1c6a512-1295-4272-9138-f99709370657
2008-04-15Slight clean up and binsize saveNils Wallménius
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17122 a1c6a512-1295-4272-9138-f99709370657
2008-03-17It makes more sense for the callback registrar to decide if its a "oneshot" ↵Jonathan Gordon
then the callback caller. (Doing it this way means playback could(/should?) registar a disk spinup callback at init which is called every spinup without needing to be reregistered) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16685 a1c6a512-1295-4272-9138-f99709370657
2008-03-16Implement the playback event handling as a system-wide multi-purpose event ↵Miika Pekkarinen
system. Unified mpeg.c and playback.c audio event handling. Converted ata_idle_notify to use the new event handling system also. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16682 a1c6a512-1295-4272-9138-f99709370657
2008-03-08Fixed red. HWCODEC platforms still use the old api.Miika Pekkarinen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16550 a1c6a512-1295-4272-9138-f99709370657
2008-03-07Rewritten playback event handling. Should fix runtime statistics gathering.Miika Pekkarinen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16546 a1c6a512-1295-4272-9138-f99709370657
2007-06-24A patch by Robert Keevil that's been in the tracker way to long, fixes FS ↵Peter D'Hoye
#6213: Audioscrobbler incorrectly submits last song git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13699 a1c6a512-1295-4272-9138-f99709370657
2007-03-16Set CONFIG_RTC to 0 for non-RTC targets, and check with #if to profit from ↵Jens Arnold
-Wundef. No code change. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12811 a1c6a512-1295-4272-9138-f99709370657
2007-03-03remove runtime detection of h1x0 series RTC MOD, but leave driver codeRobert Kukla
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12554 a1c6a512-1295-4272-9138-f99709370657
2007-02-28FS#6419 - driver for H1x0 series RTC Mod with runtime detectionRobert Kukla
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12520 a1c6a512-1295-4272-9138-f99709370657
2007-02-11Accept FS#6644 - use the ata_idle_nofity stuff for the last.fm loggingJonathan Gordon
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12267 a1c6a512-1295-4272-9138-f99709370657
2007-01-09Removed executable flagLinus Nielsen Feltzing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11966 a1c6a512-1295-4272-9138-f99709370657
2006-10-19Put the CVS revision in the CLIENT string in the scrobbler log fileLinus Nielsen Feltzing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11270 a1c6a512-1295-4272-9138-f99709370657
2006-10-19Patch #5166 by Robert Keevil - Last.fm loggingLinus Nielsen Feltzing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11269 a1c6a512-1295-4272-9138-f99709370657