Commit Graph

226 Commits

Author SHA1 Message Date
ejurgensen
249d923af2 [httpd] Allow caller of httpd_send_reply to avoid gzipping 2016-10-17 14:18:13 +02:00
Björn Ricks
382459ce9b Allow anonymous access to /content-codes url
The content-codes url provides a mapping of dmap content codes to names, it's
types and sizes. It doesn't contain any private information and therefore should
be available to anonymous users too.
2016-07-13 19:52:58 +02:00
ejurgensen
3be8afac7b [daap] Fix problem where playlists in Remote are not in correct order
Apparantly having "LIMIT -1 OFFSET 0" makes (certain versions?) of
sqlite3 unable to do the "ORDER BY". Might be a bug in sqlite. This
is only a partial fix, which will work for queries that don't actually
use an index. Those few that do may still be broken.
2016-04-10 00:11:33 +02:00
chme
c1dcc0a937 [db] Make loading of playlistitem count optional 2016-02-21 18:05:11 +01:00
ejurgensen
6e58af75cf [http_daapd] Add option to hide albums/artists with just one track 2015-12-12 23:28:48 +01:00
ejurgensen
55104015e0 Full removal of libevent 1 legacy code. Also drop pipe() in FreeBSD, since pipe2 is available now. 2015-10-19 21:15:29 +02:00
ejurgensen
cba9bc05e9 Expire sessions without strict timeout (closes #163) 2015-10-03 10:00:42 +02:00
ejurgensen
3ba76e8f40 Remove libevent 1 support in httpd_daap 2015-07-29 23:05:47 +02:00
ejurgensen
3dde23e060 Include terminating null in u8_normalize - not necessary now, but just to be safe 2015-06-06 14:47:54 +02:00
ejurgensen
8dd1e0fde2 Fix problem introduced with commit 475d5db where genres and composers don't get sorted 2015-05-26 21:10:28 +02:00
ejurgensen
475d5db573 When a playlist request contains a query make the default sort S_ALBUM,
which should keep audiobooks organized better and be in line with iTunes.

This should fix #91, and I cross my fingers it does not have other
unintended consequences.
2015-05-05 21:46:56 +02:00
chme
6dc4d53ed9 fix check for empty special playlists 2015-04-23 08:21:11 +02:00
chme
a174a1d18c [smartpl] refactoring: repurpose playlist type PL_SMART for user created
smart playlists and introduce new type PL_SPECIAL for special system
playlists
2015-04-23 08:21:10 +02:00
ejurgensen
2c5ab966e5 Adjust log messages 2015-04-22 21:54:31 +02:00
ejurgensen
94f94b03fe Swap artwork arguments so destination evbuffer comes first 2015-04-09 21:23:20 +02:00
ejurgensen
4850423118 Make hiding internet streams from normal playlists configurable 2015-03-30 21:10:59 +02:00
ejurgensen
986b37ed29 Adds a playlist folder type, it is needed for sorting since some clients (eg Retune)
require that playlist folders are sent before their content. Playlist folders should,
however, be sent after the base playlists, so the numbering is changed. At the same
time makes the value of the smart playlist type a bit less hardcoded.
2015-03-30 01:03:15 +02:00
ejurgensen
892fd9c402 Send mpco in daap playlist reply, even when 0 (like iTunes) 2015-03-29 23:34:36 +02:00
ejurgensen
e5a1495b49 Add DAAP logic for the Radio item 2015-03-16 23:33:42 +01:00
ejurgensen
cf6d94eda2 Fixup dblist for Radio item 2015-03-15 16:26:06 +01:00
chme
d7f7a746a2 Added item for "Radio" to DAAP-reply to "/databases" request 2015-03-14 23:44:17 +01:00
ejurgensen
9fdb8a5247 Add DB and DAAP support for nested playlists 2015-03-14 22:00:57 +01:00
ejurgensen
6df734f497 Cleanup libevent 2 calls in httpd_daap.c/.h 2015-03-06 21:22:05 +01:00
ejurgensen
684de40be2 Minor change of log severity ("Done with group") 2015-03-05 21:24:27 +01:00
ejurgensen
3a5d2d560f Remove libavl dependency from httpd_daap.c and also introduce random session id's 2015-02-24 22:58:47 +01:00
ejurgensen
df9bcade5a Embed libavl (v0.3.5), it is no longer available upstream and the dependency is a hassle 2015-02-14 20:58:01 +01:00
ejurgensen
ebfff85afa Fix problems with iTunes 12.1, see issue #100
- don't announce group support to iTunes
    - support for absolute http url streaming requests
2015-02-06 22:14:26 +01:00
ejurgensen
3b38bee45b Fix wrong log domain 2015-01-06 23:26:29 +01:00
ejurgensen
a69619a5a7 Implement is_remote() and change how transcode_needed() is used
transcode_needed() was getting called needlessly in http_daapd.c,
because 1) once it is determined that a given codec needs transcoding
for a given client there is no reason to call and check again, 2)
transcoding is irrelevant for remotes. Also some cleaning up of
user_agent_filter().
2014-12-28 23:37:12 +01:00
Justin Maggard
4efca3660f Fix bad free when encountering an error fetching query results. 2014-12-17 15:03:23 -08:00
Justin Maggard
e431b04310 Lower log level for missing revision-number in client update request. This is some clients' normal behavior, so we shouldn't need to need to see a message about it in the error log. 2014-12-17 15:03:23 -08:00
chme
7578bb1205 Artwork caching (pull request #61), and also:
- introduced new section in config file for sqlite pragma settings,
added config for artwork cache
- added setting of pragma synchronous, cache size and journal mode to
daap cache
2014-11-10 22:53:08 +01:00
ejurgensen
d157aca620 Save response times in DB and show in log (for debugging) 2014-08-24 12:43:32 +02:00
ejurgensen
31ef4d4e13 Add slow DAAP queries to cache automatically 2014-08-24 01:23:23 +02:00
ejurgensen
cf091e8d8b Adjust daapcache so it serves User-Agent to httpd_daap's reply handlers 2014-08-23 00:02:01 +02:00
ejurgensen
624dd40c59 Include DAAP queries from Retune and TunesRemote+ for caching
+ misc fixing up
2014-08-22 22:51:13 +02:00
ejurgensen
f997aca452 More DAAP cache adjustments 2014-08-21 23:06:52 +02:00
ejurgensen
76231cac0f Experimental caching of playlist 1 2014-08-21 10:01:47 +02:00
ejurgensen
f3a19fce8e Add DAAP cache backend 2014-08-20 00:21:48 +02:00
ejurgensen
5b4ef31758 Migrate all evhttp to non-deprecated libevent2
- well except a troublemaker in httpd_daap.c (req->flags &= ~EVHTTP_PROXY_REQUEST)
2014-05-29 23:22:00 +02:00
ejurgensen
748ce1413f Revert msed to 0 for now 2014-04-20 23:34:04 +02:00
chme
2391838ea1 announce support of playlist editing by setting "msed" to 1 2014-04-20 07:33:28 +02:00
ejurgensen
d722b18817 Add optional request-session-id to login request
- should make it easier to write curl scripts to control forked-daapd
since you avoid the need to parse the replies just to find a valid
session id
2014-04-01 22:47:04 +02:00
ejurgensen
7e2f47f9ca Minor adjustment so Valgrind is happy with string handling in user_agent_filter 2014-04-01 21:51:07 +02:00
ejurgensen
aef908b093 Don't announce support for playlist editing 2014-03-28 20:44:19 +01:00
ejurgensen
7d410fb6e7 Disable aeMk in databases reply since we don't calculate it properly 2014-03-28 19:25:15 +01:00
ejurgensen
35f8dd4233 DAAP modifications to properly show media kind shares in iTunes 2014-03-26 23:59:28 +01:00
ejurgensen
3ff4fa77be Merge branch 'libevent2' into dev 2014-03-24 04:59:08 +01:00
ejurgensen
7c3da47eb7 Small DAAP changes to align with iTunes 2014-03-23 00:23:34 +01:00
ejurgensen
687f349927 Let configure check libevent version and include according to version 2014-03-13 23:33:35 +01:00
ejurgensen
7ed6cc98c3 Add support for Spotify (squashed commit), and:
- Try to not return items which a client can't play
    - Remove inotify subscription to IN_MODIFY and IN_CREATE
    - Fix crash on unknown codec type in transcode.c
    - Probably added some new bugs...
2014-03-11 23:20:29 +01:00
ejurgensen
21fe5ac3a6 Don't reject daap login if no user-agent (for Roomie remote) 2014-01-27 20:43:22 +01:00
ejurgensen
02a73e3638 Artwork support for iTunes 11 (credit @torta) and related improvements 2013-12-25 23:06:41 +01:00
ejurgensen
ab86e30be4 Fix bug where sort fields were not implemented in group replies 2013-12-18 19:14:39 +01:00
ejurgensen
392f34bf85 Don't announce smart playlists with no items 2013-12-17 23:27:37 +01:00
ejurgensen
e79e11108e Ignore duplicate tags in DAAP requests 2013-12-16 22:09:18 +01:00
ejurgensen
d1a51ef45d 1) Protect against uninitialised fl in daap_sort_build and 2) Don't
add blank items in daap group reply
2013-12-12 23:27:50 +01:00
ejurgensen
34a5fdb2ab Sort by name if sort=releasedate (Podcasts)
We don't know release date, so use name since it's better than random
2013-12-04 21:29:58 +01:00
ejurgensen
c6119c5aa5 Force sane sorting in group replies
(because Hyperfine Remote will ask for artists sorted by album...)
2013-12-03 23:35:36 +01:00
ejurgensen
a30069c0c7 Honor sorting in more daap replies and some minor restructuring of http_daapd.c 2013-12-03 23:16:07 +01:00
ejurgensen
10e4a138a3 Fix crash after special (malformed?) TunesRemote SE daap request
Request has comma before &query:
/databases/1/containers/1/items?session-id=100&meta=dmap.itemname,[...],daap.songcompilation,&query=('com.apple...
2013-12-02 20:55:16 +01:00
ejurgensen
d85eb171cb Lower log level to spam for metadata message in httpd_daap.c 2013-11-16 22:52:53 +01:00
ejurgensen
7bb2fef25f Lower log level to spam for DMAP investigation and add dmap_add_raw_uint32() for later use 2013-11-14 23:08:20 +01:00
ejurgensen
28b485c595 Fix malformed DAAP packages 2013-11-10 12:35:24 +01:00
ejurgensen
9b190fe282 Fix group-type-type 2013-08-29 22:43:59 +02:00
ejurgensen
95fc525beb Add support for artist group request (experimental)
The purpose of this is mainly to support Hyperfine Remote for Android
2013-08-29 22:00:37 +02:00
Craig Markwardt
c2e6eeda32 Fixes for Amarok and Banshee clients which don't send
revision-number in their update request.

Details: Banshee (v1.6.1) and Amarok client players send an
update request but do not send the revision-number parameter.
iTunes version 10 (and perhaps earlier) does send this parameter.
See: https://github.com/jasonmc/forked-daapd/issues/78

Fix: function daap_reply_update() now warns when revision-number
is not submitted by the client, but does not reply with an error.
In that case the server assumes a revision-number which insures
an update is sent back to the client.

Testing:
I verified that the following clients were able to connect succesfully
and retrieve a library listing:
  * iTunes 10.5.2
  * iTunes 10.4.2
  * iTunes 9.7.1
  * Rhythmbox 0.12.8
  * Banshee 1.6.1
I can't test with Amarok since I don't have this client.
2012-01-02 04:22:39 -05:00
Craig Markwardt
bd10978d52 Fixes for iTunes v10.5 time-outs.
Details:

iTunes v10.5 clients changed how they responded to DAAP
protocol, and started disconnecting when the forked-daapd server
sent an empty "refresh" reply ("mupd" protocol).  This problem is
also coupled with session-timeout ("mstm" and "msal"); when these
server capabilities were enabled, iTunes 10.x clients did not poll
for updates and eventually disconnected.

I investigated DAAP network packets using Wireshark.  I found that
a true iTunes server sends a set of server capabilities in a specific
order, and order matters to the client.  When the correct order is used,
the client correctly polls for updates and does not disconnect.

This change:
  1. Send server capabilities in different order (daap_reply_server_info).
  2. Disables 5-minute update refresh.
  3. Disables 30-minute inactivity time-out.

Testing:
This server version successfully stayed connected to the
following clients:
  * iTunes 10.5.2
  * iTunes 10.4.2
  * iTunes 9.7.1
  * Rhythmbox 0.12.8
The clients stayed connected for at least several hours,
sometimes days, with activity or no activity.
2012-01-02 02:15:18 -05:00
Julien BLACHE
4be0d86aa0 Revert "Disable session expiration"
This reverts commit c70caad87e.
2011-09-10 18:44:37 +02:00
Julien BLACHE
9f06848d43 Reply to update requests periodically to avoid 30-minute iTunes timeout
Craig Markwardt <craig.markwardt@gmail.com> found out that the 30-minute
timeout in iTunes was caused by the lack of reply to update requests.

We now send out replies every 5 minutes, avoiding the timeout and
disconnection.

Thanks to Craig for digging into this, producing code to demonstrate the fix
and trying out a few more ideas for update support beyond this fix.
2011-09-10 18:37:16 +02:00
Julien BLACHE
a70a45d925 Fix DAAP songlist generation after code move to dmap_common
Handling of the sort tags was left into httpd_daap.c where the code runs
after the song is added to the songlist - effectively adding the sort tags
to the *next* song, leading to incorrect sort tags on the current song.
2011-04-28 18:25:14 +02:00
Julien BLACHE
718d1e9487 Migrate file metadata encoding to DMAP common code 2011-04-09 10:11:35 +02:00
Julien BLACHE
07df6bb4aa Move dmap_add_field() to DMAP common code 2011-04-09 10:11:35 +02:00
Julien BLACHE
39542aee27 Move DMAP fields list and hash table to DMAP common code 2011-04-09 10:11:34 +02:00
Julien BLACHE
52691d6c4d Rename dmap_helpers.[ch] to dmap_common.[ch] 2011-04-09 10:11:34 +02:00
Julien BLACHE
e23f02c7c0 Replace AVL tree in DAAP by a static hash using gperf 2011-04-02 09:52:19 +02:00
Julien BLACHE
303a3329eb Replace AVL tree in DAAP query by a static hash using gperf 2011-04-02 09:52:19 +02:00
Julien BLACHE
204c9681ca Enable and handle JPEG artwork in DAAP 2011-04-01 22:02:51 +02:00
Julien BLACHE
c7209ab699 Add support for JPEG as a valid artwork output format
Reduce CPU usage by avoiding unneeded JPEG -> PNG conversions; it appears
all the clients we care about support JPEG as well as PNG.
2011-03-30 21:50:29 +02:00
Julien BLACHE
f5b167080b Use title_sort for DAAP sort headers 2011-03-21 18:48:00 +01:00
Kai Elwert
4dce6390ea Switch to using db_query_fetch_string_sort() in daap_reply_browse() 2011-03-21 18:48:00 +01:00
Kai Elwert
bf86cf45bd Always include sort tags in songlist 2011-03-21 18:47:59 +01:00
Julien BLACHE
c70caad87e Disable session expiration
Auto-logout currently doesn't work as expected and breaks streaming etc once
the timeout occurs. Disable it until we can make it work as expected.

Maybe we'll need to upgrade the DAAP version.
2010-11-11 10:44:57 +01:00
Kai Elwert
e5af78fe9f Implement sort=artist for DAAP queries 2010-10-09 16:06:00 +02:00
Kai Elwert
ee7b976eeb Advertise DAAP updates support in server-info
We don't send out DAAP updates, but Remote requires this to work.
2010-10-09 15:54:53 +02:00
Julien BLACHE
f7c2bf756a Remove duplicate mstm tag in server-info reply 2010-09-18 22:50:26 +02:00
Julien BLACHE
535d691a4a Fix full_uri memory leak in error path 2010-09-10 18:47:42 +02:00
Kai Elwert
de8884c8df Add sort-headers support to DAAP song lists 2010-09-04 10:58:25 +02:00
Kai Elwert
ee294753e1 Add sort-headers support to DAAP groups query 2010-08-29 12:07:08 +02:00
Kai Elwert
8a2d76895c Add sort-headers support to DAAP browse query 2010-08-29 12:07:08 +02:00
Kai Elwert
eaaaec91a1 Introduce DAAP sort-headers helpers 2010-08-29 12:07:07 +02:00
Kai Elwert
d4f341aff0 Handle include-sort-headers parameter in DAAP queries 2010-08-29 12:07:07 +02:00
Julien BLACHE
471f750a8c Rework error handling where an oom variable was used
The oom-specific message was actually never used as it was hidden by
ret being < 0 and that condition was tested before oom.
2010-08-29 12:05:02 +02:00
Julien BLACHE
1d35afbe62 Fixup file modes 2010-08-06 17:27:56 +02:00
Kai Elwert
ca72ee5926 Handle sort parameter in DAAP queries
This is used by Remote for the Title view.
2010-08-05 18:28:02 +02:00
Kai Elwert
4347731133 Add mpco to playlists, hardcode to 0 for now 2010-07-31 10:40:39 +02:00
Kai Elwert
931c0aac29 Map mper to playlist id for playlists 2010-07-31 10:39:41 +02:00
Julien BLACHE
25ee24d2be Properly deinit DAAP sessions
Call event_del() before freeing the session when clearing the AVL tree. Caused
an infinite loop in event_base_free() in httpd_deinit().
2010-07-30 21:52:04 +02:00
Julien BLACHE
f6a9e1f7f4 Kill update request connections during deinit
Avoid leaving active requests on the HTTP server before shutting it down.
2010-07-30 21:42:53 +02:00
Julien BLACHE
81d09ed234 Account for new evhttp behaviour on failed incoming connections
The evcon associated with a request is freed by evhttp when the connection
fails. Protect against a NULL evcon when handling the connection failure.
2010-07-23 18:28:29 +02:00