Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expose /recording/find-recording-tracks

  • Loading branch information...
commit 7d96db84162a36122b60984957fb3ab7ec8a541c 1 parent 796544e
@ocharles ocharles authored
View
1  .gitignore
@@ -13,3 +13,4 @@ cabal-dev
/*.html
/test.cfg
/test/suite/Tests
+/log
2  musicbrainz-data
@@ -1 +1 @@
-Subproject commit bc06dae2817be16997073e1df26d876021fc40c6
+Subproject commit cd2243face582bc545a7c9401b5450f6ce8a4aa2
View
9 src/MusicBrainz/API/JSON.hs
@@ -22,6 +22,7 @@ import qualified Data.Map as Map
import qualified Data.Text as Text
import MusicBrainz
+import MusicBrainz.Data.Recording (RecordingUse(..))
--------------------------------------------------------------------------------
instance ToJSON (MBID a) where
@@ -239,6 +240,13 @@ instance ToJSON PartialDate where
--------------------------------------------------------------------------------
+instance ToJSON RecordingUse where
+ toJSON RecordingUse{..} = object [ "track" .= recordingTrack
+ , "release" .= recordingTrackRelease
+ ]
+
+
+--------------------------------------------------------------------------------
instance (Referenceable a, ToJSON (RefSpec a)) => ToJSON (Ref a) where
toJSON = toJSON . dereference
@@ -304,3 +312,4 @@ instance TopLevel ()
instance TopLevel Annotation
instance TopLevel EligibleForCleanup
instance TopLevel a => TopLevel [a]
+instance TopLevel RecordingUse
View
8 src/MusicBrainz/API/Recording.hs
@@ -10,11 +10,12 @@ import Text.Digestive
import qualified Data.Map as Map
import qualified Data.Set as Set
-import MusicBrainz
+import MusicBrainz hiding (coreRef)
import MusicBrainz.API
import qualified MusicBrainz.API.Common as Common
import MusicBrainz.API.JSON
import qualified MusicBrainz.Data as MB
+import qualified MusicBrainz.Data.Recording as MB
--------------------------------------------------------------------------------
tree :: Form Text MusicBrainz (Tree Recording)
@@ -76,3 +77,8 @@ merge = Common.merge
--------------------------------------------------------------------------------
getRevision :: Form Text MusicBrainz (Entity (Revision Recording))
getRevision = Common.getRevision
+
+
+--------------------------------------------------------------------------------
+findRecordingTracks :: Form Text MusicBrainz [MB.RecordingUse]
+findRecordingTracks = runApi $ MB.findRecordingTracks <$> "recording" .: coreRef
View
1  src/MusicBrainz/Service.hs
@@ -277,6 +277,7 @@ serviceInit connInfo sessionStore =
, ("/recording/create", expose Recording.create)
, ("/recording/find-latest", expose Recording.findLatest)
+ , ("/recording/find-recording-tracks", expose Recording.findRecordingTracks)
, ("/recording/get-revision", expose Recording.getRevision)
, ("/recording/merge", expose Recording.merge)
, ("/recording/update", expose Recording.update)
View
1  test/suite/Handlers.hs
@@ -51,6 +51,7 @@ tests = map testHandlerExists
, "/label/view-revision"
, "/recording/create"
, "/recording/find-latest"
+ , "/recording/find-recording-tracks"
, "/recording/get-revision"
, "/recording/merge"
, "/recording/update"
Please sign in to comment.
Something went wrong with that request. Please try again.