Exemple #1
0
 public AddShoutCommand(ILastAuth auth, string album, string artist, string message)
     : base(auth)
 {
     Album   = album;
     Artist  = artist;
     Message = message;
 }
Exemple #2
0
 public GetTagsByUserCommand(ILastAuth auth, string artist, string album, string username)
     : base(auth)
 {
     ArtistName = artist;
     AlbumName  = album;
     Username   = username;
 }
        public GetRecentScrobblesCommand(ILastAuth auth, string username, DateTime from) : base(auth)
        {
            Method = "user.getRecentTracks";

            Username = username;
            From     = from;
        }
Exemple #4
0
 public UpdateNowPlayingCommand(ILastAuth auth, string artist, string album, string track)
     : base(auth)
 {
     Artist = artist;
     Album  = album;
     Track  = track;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="windowManager">WindowManager used to display dialogs.</param>
 /// <param name="displayName">Display name.</param>
 /// <param name="trackAPI">Last.fm API object for getting track information.</param>
 /// <param name="albumAPI">Last.fm API object for getting album information.</param>
 /// <param name="lastAuth">Last.fm authentication object.</param>
 public MediaPlayerScrobbleViewModelBase(IExtendedWindowManager windowManager, string displayName, ITrackApi trackAPI, IAlbumApi albumAPI, ILastAuth lastAuth)
     : base(windowManager, displayName)
 {
     _trackAPI = trackAPI;
     _albumAPI = albumAPI;
     _lastAuth = lastAuth;
 }
        public GetSimilarArtistsCommand(ILastAuth auth, string artistName)
            : base(auth)
        {
            Method = "artist.getSimilar";

            ArtistName = artistName;
        }
Exemple #7
0
        public MainViewModel(ILastAuth lastAuth)
        {
            _lastAuth = lastAuth;

            GenerateProgressReportCommand = new AsyncDelegateCommand(GenerateProgressReport);
            OpenReportCommand             = new DelegateCommand(OpenProgressReport);
            ExecuteSelectedCommandCommand = new AsyncDelegateCommand(ExecuteSelectedCommand);
            DeleteConfigCommand           = new DelegateCommand(() =>
            {
                if (_configPath != null && File.Exists(_configPath))
                {
                    File.Delete(_configPath);
                }

                InitialiseState();
            });

            var currentDir = AppDomain.CurrentDomain.BaseDirectory;

            SolutionDir = Path.GetFullPath(currentDir + "../../../../"); // assuming this is running in debug dir
            _configPath = Path.GetFullPath(SolutionDir + SYRO_CONFIG_FILENAME);

            BaseCommandTypes = new List <Type>
            {
                typeof(DummyGetAsyncCommand <>),
                typeof(DummyPostAsyncCommand <>)
            };
            LastObjectTypes   = Reflektor.FindClassesCastableTo(typeof(ILastfmObject));
            LastResponseTypes = Reflektor.FindClassesCastableTo(typeof(LastResponse));

            InitialiseState();

            Application.Current.Exit += OnAppExit;
        }
Exemple #8
0
        public SearchAlbumsCommand(ILastAuth auth, string albumName)
            : base(auth)
        {
            Method = "album.search";

            AlbumName = albumName;
        }
        public AddShoutCommand(ILastAuth auth, string artist, string message) : base(auth)
        {
            Method = "artist.shout";

            Artist  = artist;
            Message = message;
        }
        public AddShoutCommand(ILastAuth auth, string track, string artist, string message) : base(auth)
        {
            Method = "track.shout";

            Track   = track;
            Artist  = artist;
            Message = message;
        }
Exemple #11
0
 public GetTracksCommand(ILastAuth auth, string username, string artist, string album, DateTimeOffset from)
     : base(auth)
 {
     Username = username;
     Artist   = artist;
     Album    = album;
     From     = from;
 }
Exemple #12
0
        public AddShoutCommand(ILastAuth auth, string recipient, string message)
            : base(auth)
        {
            Method = "user.shout";

            Recipient = recipient;
            Message   = message;
        }
        public ArtistGetTagsByUserCommand(ILastAuth auth, string artist, string username)
            : base(auth)
        {
            Method = "artist.getTags";

            ArtistName = artist;
            Username   = username;
        }
Exemple #14
0
        public GetAlbumShoutsCommand(ILastAuth auth, string albumname, string artistname)
            : base(auth)
        {
            Method = "album.getShouts";

            AlbumName  = albumname;
            ArtistName = artistname;
        }
Exemple #15
0
        public GetTrackShoutsCommand(ILastAuth auth, string trackname, string artistname)
            : base(auth)
        {
            Method = "track.getShouts";

            TrackName  = trackname;
            ArtistName = artistname;
        }
Exemple #16
0
        public UnloveTrackCommand(ILastAuth auth, string trackname, string artistname)
            : base(auth)
        {
            Method = "track.unlove";

            TrackName  = trackname;
            ArtistName = artistname;
        }
Exemple #17
0
        public GetSimilarTracksCommand(ILastAuth auth, string trackName, string artistName)
            : base(auth)
        {
            Method = "track.getSimilar";

            ArtistName = artistName;
            TrackName  = trackName;
        }
Exemple #18
0
        public TrackUpdateNowPlayingCommand(ILastAuth auth, string artist, string album, string track)
            : base(auth)
        {
            Method = "track.updateNowPlaying";

            Artist = artist;
            Album  = album;
            Track  = track;
        }
        public GetUserTagsForAlbumCommand(ILastAuth auth, string album, string artist, string username)
            : base(auth)
        {
            Method = "album.getTags";

            AlbumName  = album;
            ArtistName = artist;
            UserName   = username;
        }
        public AlbumGetTagsByUserCommand(ILastAuth auth, string artist, string album, string username)
            : base(auth)
        {
            Method = "album.getTags";

            ArtistName = artist;
            AlbumName  = album;
            Username   = username;
        }
Exemple #21
0
 public GetTracksCommand(ILastAuth auth, string username, string artist, string album, DateTimeOffset since)
     : base(auth)
 {
     Username = username;
     Artist   = artist;
     Album    = album;
     Since    = since;
     Page     = 1;
 }
Exemple #22
0
        public ScrobbleCommand(ILastAuth auth, IList <Scrobble> scrobbles)
            : base(auth)
        {
            if (scrobbles.Count > 50)
            {
                throw new ArgumentOutOfRangeException("scrobbles", "Only 50 scrobbles can be sent at a time");
            }

            Scrobbles = scrobbles;
        }
Exemple #23
0
        public LibraryGetTracksCommand(ILastAuth auth, string username, string artist, string album, DateTimeOffset from)
            : base(auth)
        {
            Method = "library.getTracks";

            Username = username;
            Artist   = artist;
            Album    = album;
            From     = from;
        }
Exemple #24
0
        public TrackScrobbleCommand(ILastAuth auth, string artist, string album, string track, string albumArtist, DateTimeOffset?timeplayed)
            : base(auth)
        {
            Method = "track.scrobble";

            Artist      = artist;
            Album       = album;
            Track       = track;
            AlbumArtist = albumArtist;
            TimePlayed  = timeplayed;
        }
Exemple #25
0
 public LastFmLoginService(
     ISettingsService settingsService,
     ILastAuth lastAuth,
     INavigationService navigationService,
     IPlayerService playerService,
     IPurchaseService purchaseService)
 {
     _settingsService   = settingsService;
     _lastAuth          = lastAuth;
     _navigationService = navigationService;
     _playerService     = playerService;
     _purchaseService   = purchaseService;
 }
Exemple #26
0
        public async Task <bool> Scrobble(ILastAuth Auth, params string[] data)
        {
            IFolder rootFolder = FileSystem.Current.LocalStorage;
            IFolder folder     = await rootFolder.CreateFolderAsync("db",
                                                                    CreationCollisionOption.OpenIfExists);

            IFile file = await folder.CreateFileAsync("scrobbles.db",
                                                      CreationCollisionOption.ReplaceExisting);

            IScrobbler _scrobbler = new BreadScrobbler(Auth, file.Path);

            return((await _scrobbler.ScrobbleAsync(new IF.Lastfm.Core.Objects.Scrobble(data[0], data[1], data[2], DateTimeOffset.Now))).Success);
        }
        /// <summary>
        /// Constructor.
        /// Deserializes the users.
        /// </summary>
        /// <param name="windowManager">WindowManager used to display dialogs.</param>
        /// <param name="lastAuth">Last.fm authentication object.</param>
        /// <param name="fileOperator">FileOperator used to write to disk.</param>
        /// <param name="directoryOperator">DirectoryOperator used to check and create directories.</param>
        /// <param name="userSerializer">Serializer used to serialize <see cref="User"/>.</param>
        public UserViewModel(IExtendedWindowManager windowManager, ILastAuth lastAuth, IFileOperator fileOperator, IDirectoryOperator directoryOperator, ISerializer <User> userSerializer)
        {
            _windowManager     = windowManager;
            _lastAuth          = lastAuth;
            _fileOperator      = fileOperator;
            _directoryOperator = directoryOperator;
            _userSerializer    = userSerializer;
            AvailableUsers     = new ObservableCollection <User>();

            if (!_directoryOperator.Exists(USERSFOLDER))
            {
                _directoryOperator.CreateDirectory(USERSFOLDER);
            }

            DeserializeUsers();
        }
Exemple #28
0
        /// <summary>
        /// Constructor.
        /// Deserializes the users.
        /// </summary>
        /// <param name="windowManager">WindowManager used to display dialogs.</param>
        /// <param name="lastAuth">Last.fm authentication object.</param>
        /// <param name="userApi">Api to get recent scrobbles with.</param>
        /// <param name="fileOperator">FileOperator used to write to disk.</param>
        /// <param name="directoryOperator">DirectoryOperator used to check and create directories.</param>
        /// <param name="userSerializer">Serializer used to serialize <see cref="User"/>.</param>
        public UserViewModel(IExtendedWindowManager windowManager, ILastAuth lastAuth, IUserApi userApi, IFileOperator fileOperator, IDirectoryOperator directoryOperator, ISerializer userSerializer)
        {
            _windowManager     = windowManager;
            _lastAuth          = lastAuth;
            _userApi           = userApi ?? throw new ArgumentNullException(nameof(userApi));
            _fileOperator      = fileOperator;
            _directoryOperator = directoryOperator;
            _userSerializer    = userSerializer;
            AvailableUsers     = new ObservableCollection <User>();

            if (!_directoryOperator.Exists(USERSFOLDER))
            {
                _directoryOperator.CreateDirectory(USERSFOLDER);
            }

            DeserializeUsers();
            LoadLastUser();
        }
        public MainViewModel(ILastAuth lastAuth)
        {
            _lastAuth = lastAuth;

            GenerateProgressReportCommand = new AsyncDelegateCommand(GenerateProgressReport);
            OpenReportCommand             = new DelegateCommand(OpenProgressReport);
            ExecuteSelectedCommandCommand = new AsyncDelegateCommand(ExecuteSelectedCommand);

            var currentDir = AppDomain.CurrentDomain.BaseDirectory;

            SolutionDir = Path.GetFullPath(currentDir + "../../../../"); // assuming this is running in debug dir

            BaseCommandTypes = new List <Type>
            {
                typeof(DummyGetAsyncCommand <>),
                typeof(DummyPostAsyncCommand <>)
            };
            LastObjectTypes   = Reflektor.FindClassesCastableTo(typeof(ILastfmObject));
            LastResponseTypes = Reflektor.FindClassesCastableTo(typeof(LastResponse));

            SelectedBaseCommandType = BaseCommandTypes.FirstOrDefault();
            SelectedLastObjectType  = LastObjectTypes.FirstOrDefault();
            SelectedResponseType    = LastResponseTypes.FirstOrDefault();

            CommandParameters = new ObservableCollection <Pair <string, string> >(new List <Pair <string, string> >
            {
                new Pair <string, string>(),
                new Pair <string, string>(),
                new Pair <string, string>(),
                new Pair <string, string>(),
                new Pair <string, string>()
            });

            CommandMethodName = "album.getInfo";
            CommandPageNumber = "0";
            CommandItemCount  = "20";
        }
Exemple #30
0
 public AlbumApi(ILastAuth auth, HttpClient httpClient = null)
     : base(httpClient)
 {
     Auth = auth;
 }
Exemple #31
0
        protected ScrobblerBase(ILastAuth auth, HttpClient httpClient = null) : base(httpClient)
        {
            _auth = auth;

            MaxBatchSize = 50;
        }
Exemple #32
0
 public LibraryApi(ILastAuth auth, HttpClient httpClient = null)
     : base(httpClient)
 {
     Auth = auth;
 }
Exemple #33
0
        public MainViewModel(ILastAuth lastAuth)
        {
            _lastAuth = lastAuth;

            GenerateProgressReportCommand = new AsyncDelegateCommand(GenerateProgressReport);
            OpenReportCommand = new DelegateCommand(OpenProgressReport);
            ExecuteSelectedCommandCommand = new AsyncDelegateCommand(ExecuteSelectedCommand);
            DeleteConfigCommand = new DelegateCommand(() =>
            {
                if (_configPath != null && File.Exists(_configPath))
                {
                    File.Delete(_configPath);
                }

                InitialiseState();
            });

            var currentDir = AppDomain.CurrentDomain.BaseDirectory;
            SolutionDir = Path.GetFullPath(currentDir + "../../../../"); // assuming this is running in debug dir
            _configPath = Path.GetFullPath(SolutionDir + SYRO_CONFIG_FILENAME);

            BaseCommandTypes = new List<Type>
            {
                typeof(DummyGetAsyncCommand<>),
                typeof(DummyPostAsyncCommand<>)
            };
            LastObjectTypes = Reflektor.FindClassesCastableTo(typeof(ILastfmObject));
            LastResponseTypes = Reflektor.FindClassesCastableTo(typeof(LastResponse));

            InitialiseState();

            Application.Current.Exit += OnAppExit;
        }
Exemple #34
0
 public TrackApi(ILastAuth auth, HttpClient httpClient = null)
     : base(httpClient)
 {
     Auth = auth;
 }
Exemple #35
0
        public SQLiteScrobbler(ILastAuth auth, string databasePath, HttpClient client = null) : base(auth, client)
        {
            DatabasePath = databasePath;

            CacheEnabled = true;
        }
Exemple #36
0
 public ChartApi(ILastAuth auth, HttpClient httpClient = null)
     : base(httpClient)
 {
     Auth = auth;
 }
Exemple #37
0
 public Scrobbler(ILastAuth auth, HttpClient httpClient = null) : base(auth, httpClient)
 {
     CacheEnabled = false;
 }
Exemple #38
0
 public GetInfoCommand(ILastAuth auth, string album, string artist)
     : this(auth)
 {
     AlbumName  = album;
     ArtistName = artist;
 }
Exemple #39
0
 public void Initialise()
 {
     _auth = new LastAuth("user", "pass");
 }