1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  package com.buckosoft.BuckoVidLib.web.plex.client;
31  
32  import javax.ws.rs.GET;
33  import javax.ws.rs.Path;
34  import javax.ws.rs.PathParam;
35  
36  import org.apache.commons.logging.Log;
37  import org.apache.commons.logging.LogFactory;
38  import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
39  
40  import tv.plex.domain.MediaContainer;
41  
42  
43  
44  
45  
46  public class LibraryClient extends AbstractClient<LibraryService> implements LibraryService {
47  	private final Log log = LogFactory.getLog(getClass());
48  
49  	@SuppressWarnings("rawtypes")
50  	public LibraryClient(String endpointUrl) {
51  		super(endpointUrl);
52  		providers.add(new JAXBElementProvider());
53  	}
54  
55  	@Override
56  	@GET
57  	@Path("/")
58  	public MediaContainer root() {
59  		return(serviceProxy.root());
60  	}
61  	
62  	public MediaContainer sections() {
63  		return(serviceProxy.sections());
64  	}
65  	
66  	public MediaContainer videosAll(int key) {
67  		return(serviceProxy.videosAll(key));
68  	}
69  
70  	public MediaContainer recentlyAdded() {
71  		MediaContainer mc;
72  		try {
73  			mc = serviceProxy.recentlyAdded();
74  		} catch (Exception e) {
75  			log.warn("recentlyAdded call to Plex failed");
76  			return(null);
77  		}
78  		return(mc);
79  	}
80  
81  	
82  
83  
84  	@Override
85  	@GET
86  	@Path("/metadata/{key}/children")
87  	public MediaContainer tvSeasons(@PathParam("key") int key) {
88  		return(serviceProxy.tvSeasons(key));
89  	}
90  
91  	
92  
93  
94  	@Override
95  	@GET
96  	@Path("/metadata/{key}/children")
97  	public MediaContainer tvShows(@PathParam("key") int key) {
98  		return(serviceProxy.tvShows(key));
99  	}
100 
101 }
102