コード例 #1
0
ファイル: MusicBox.cs プロジェクト: Bold-Taco/SILO
        protected void CheckForStationTags(PandoraSong song)
        {
            if (!RemoveStationTags)
                return;

            foreach (string currTag in specialStationTags) {
                if (song.Artist.EndsWith(currTag)) {
                    song.Artist = song.Artist.Remove(song.Artist.LastIndexOf(currTag)).Trim();
                    return;
                }
            }
        }
コード例 #2
0
ファイル: MusicBox.cs プロジェクト: Bold-Taco/SILO
 /// <summary>
 /// Ban this song from playing on any of the users stations for one month.
 /// </summary>
 /// <param name="song"></param>
 public void TemporarilyBanSong(PandoraSong song)
 {
     VerifyAndExecute(delegate {
         pandora.AddTiredSong(Session, song, Proxy);
     });
 }
コード例 #3
0
ファイル: MusicBox.cs プロジェクト: Bold-Taco/SILO
 /// <summary>
 /// Rate the specified song. A positive or negative rating will influence future songs 
 /// played from the current station.
 /// </summary>
 /// <param name="rating"></param>
 /// <param name="song"></param>
 public void RateSong(PandoraSong song, PandoraRating rating)
 {
     VerifyAndExecute(delegate {
         pandora.RateSong(Session, CurrentStation, song, rating);
     });
 }
コード例 #4
0
ファイル: DirectShowPlayer.cs プロジェクト: Bold-Taco/SILO
 /**
  * Constructor for Player Object
  */
 public DirectShowPlayer() {
     graphBuilder = null;
     _IsPlaying = false;
     PreviousVolume = null;
     loadedSong = null;
 }
コード例 #5
0
ファイル: DirectShowPlayer.cs プロジェクト: Bold-Taco/SILO
        public void Close() {
            // store current volume so it persists from track to track
            if (loadedSong != null)
                PreviousVolume = Volume;

            Stop();

            lock (lockingToken) {
                mediaEventEx = null;
                mediaSeeking = null;
                mediaControl = null;
                mediaPosition = null;
                basicAudio = null;

                if (this.graphBuilder != null)
                    Marshal.ReleaseComObject(this.graphBuilder);
                this.graphBuilder = null;
            }

            loadedSong = null;
            _IsPlaying = false;
        }
コード例 #6
0
ファイル: DirectShowPlayer.cs プロジェクト: Bold-Taco/SILO
        public bool Open(PandoraSong file) {
            try {
                Close();

                graphBuilder = (IGraphBuilder)new FilterGraph();

                // create interface objects for various actions
                mediaControl = (IMediaControl)graphBuilder;
                mediaEventEx = (IMediaEventEx)graphBuilder;
                mediaSeeking = (IMediaSeeking)graphBuilder;
                mediaPosition = (IMediaPosition)graphBuilder;
                basicAudio = (IBasicAudio)graphBuilder;

                int hr = 0;

                StartEventLoop();

                //hr = graphBuilder.AddFilter(

                // Have the graph builder construct its the appropriate graph automatically
                hr = graphBuilder.RenderFile(file.AudioURL, null);
                DsError.ThrowExceptionForHR(hr);

                // maintain previous volume level so it persists from track to track
                if (PreviousVolume != null)
                    Volume = (double)PreviousVolume;

                loadedSong = file;
                return true;
            }
            catch (Exception) {
                return false;
            }

        }