View Javadoc
1   /******************************************************************************
2    * LibraryManager.java - Synchronize access to the library
3    * 
4    * BuckoVidLib - The BuckoSoft Video Library
5    * Copyright(c) 2015 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.BuckoVidLib.business;
9   
10  import java.util.List;
11  import java.util.regex.Pattern;
12  
13  import com.buckosoft.BuckoVidLib.domain.Actor;
14  import com.buckosoft.BuckoVidLib.domain.Director;
15  import com.buckosoft.BuckoVidLib.domain.LibrarySection;
16  import com.buckosoft.BuckoVidLib.domain.TVSeason;
17  import com.buckosoft.BuckoVidLib.domain.Video;
18  import com.buckosoft.BuckoVidLib.domain.VideoBase;
19  import com.buckosoft.BuckoVidLib.domain.Writer;
20  import com.buckosoft.BuckoVidLib.domain.rest.admin.RestRefreshStatus;
21  
22  /** API to the library.<br>
23   * All access to the library goes through this module.<br>
24   * This is so we can synchronize access, free up stale memory, 
25   * and check for new library entries.<br>
26   * This module understands the allowRestricted flag, which tells us whether the user can/wants
27   * to receive Videos from the restricted sections of the library.
28   * @author dick
29   * @since 2015-03-21
30   */
31  public interface LibraryManager {
32  	List<LibrarySection> getSectionList();
33  	List<LibrarySection> getSectionList(boolean allowRestricted);
34  
35  	VideoBase getRandomMovie(boolean allowRestricted);
36  	
37  	Video		getVideoFromKey(int key, boolean allowRestricted);
38  	VideoBase	getVideoBaseFromKey(int key, boolean allowRestricted);
39  	
40  	List<VideoBase>		getNewestVideos(int count, boolean allowRestricted);
41  	List<VideoBase>		findVideos(Pattern pattern, boolean allowRestricted, int maxReturned);
42  	List<Actor>			findActors(String key, int maxReturned);
43  	List<Director>		findDirectors(String key, int maxReturned);
44  	List<Writer>		findWriters(String key, int maxReturned);
45  
46  	TVSeason			getTVSeasonFromHashKey(int key);
47  	
48  	int	getMovieCount(boolean allowRestricted);
49  	
50  	int	getTVShowCount(boolean allowRestricted);
51  
52  	/** Return the number of TV episodes we have 
53  	 * @param allowRestricted Note: allowRestricted is ignored
54  	 * @return
55  	 */
56  	int	getTVEpisodeCount(boolean allowRestricted);
57  
58  	List<VideoBase>	getLibrarySectionVideos(int key);
59  
60  	List<VideoBase>	getDirectorVideos(int key);
61  	List<VideoBase>	getWriterVideos(int key);
62  	List<VideoBase>	getActorVideos(int key);
63  
64  	long					getLastUpdateTime();
65  	
66  	/** Start the slow background thread that refreshes our database from plex.
67  	 */
68  	void startRefreshLibraryFromPlex();
69  	
70  	/** Fetch a status about how the RefreshLibraryFromPlex thread is doing.
71  	 * @return The status.
72  	 */
73  	RestRefreshStatus getRefreshLibraryFromPlexStatus();
74  
75  }