Пример #1
0
 //iTunesの曲変更イベント
 void iTunes_OnPlayerPlayEvent(object iTrack)
 {
     Core.iTunesClass song = new Core.iTunesClass(iTunes.CurrentTrack);
     //曲が変更された時だけイベントを取るから前回と比較する
     if (song.TrackDatabaseID != LastSong.TrackDatabaseID)
     {
         LastSong = song;
         OnPlayerPlayEvent(song);
     }
 }
Пример #2
0
        void PipeThread()
        {
            NamedPipeServerStream pipeServer = null;

            try
            {
                pipeServer = new NamedPipeServerStream("NowPlayingtunesSongPipe", PipeDirection.InOut);
                pipeServer.WaitForConnection();
                //When Connected
                StreamString stream    = new StreamString(pipeServer);
                String       playerStr = stream.ReadString();
                Debug.WriteLine("[foobar2000]Song changed.");
                Debug.WriteLine(playerStr);
                Debug.WriteLine("[foobar2000]dump end.");
                String[]         playerStrSplit = playerStr.Split('\n');
                Core.iTunesClass song           = new Core.iTunesClass();
                song.AlbumArtworkEnabled = false;
                song.SongTitle           = playerStrSplit[0];
                song.SongAlbum           = playerStrSplit[1];
                song.SongArtist          = playerStrSplit[2];
                song.SongAlbumArtist     = playerStrSplit[3];
                song.isFoobar            = true;
                try
                {
                    song.SongTrackNumber = int.Parse(playerStrSplit[4]);
                }
                catch (Exception ex2)
                {
                }
                song.SongGenre    = playerStrSplit[5];
                song.SongComposer = playerStrSplit[6];

                pipeServer.Close();
                pipeServer.Dispose();
                //適当にイベント発生させる
                onSongChangedEvent(song);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("[foobar2000] ERROR");
                Debug.WriteLine(ex.ToString());
            }
            finally
            {
                if (pipeServer != null)
                {
                    if (pipeServer.IsConnected)
                    {
                        pipeServer.Dispose();
                    }
                }
            }
            //Remake thread
            StartThread();
        }
        void PipeThread()
        {
            NamedPipeServerStream pipeServer = null;
            try
            {
                pipeServer = new NamedPipeServerStream("NowPlayingtunesSongPipe", PipeDirection.InOut);
                pipeServer.WaitForConnection();
                //When Connected
                StreamString stream = new StreamString(pipeServer);
                String playerStr = stream.ReadString();
                Debug.WriteLine("[foobar2000]Song changed.");
                Debug.WriteLine(playerStr);
                Debug.WriteLine("[foobar2000]dump end.");
                String[] playerStrSplit = playerStr.Split('\n');
                Core.iTunesClass song = new Core.iTunesClass();
                song.AlbumArtworkEnabled = false;
                song.SongTitle = playerStrSplit[0];
                song.SongAlbum = playerStrSplit[1];
                song.SongArtist = playerStrSplit[2];
                song.SongAlbumArtist = playerStrSplit[3];
                song.isFoobar = true;
                try
                {
                    song.SongTrackNumber = int.Parse(playerStrSplit[4]);
                }
                catch (Exception ex2)
                {
                }
                song.SongGenre = playerStrSplit[5];
                song.SongComposer = playerStrSplit[6];

                pipeServer.Close();
                pipeServer.Dispose();
                //適当にイベント発生させる
                onSongChangedEvent(song);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("[foobar2000] ERROR");
                Debug.WriteLine(ex.ToString());
            }
            finally
            {
                if (pipeServer != null)
                {
                    if (pipeServer.IsConnected)
                    {
                        pipeServer.Dispose();
                    }
                }
            }
            //Remake thread
            StartThread();
        }
Пример #4
0
        void PipeThread()
        {
            NamedPipeServerStream pipeServer = null;

            try
            {
                pipeServer = new NamedPipeServerStream("NowPlayingTunes", PipeDirection.InOut);
                StreamString stream = new StreamString(pipeServer);
                pipeServer.WaitForConnection();
                //When Connected
                if (Song.getLatestSong() != null)
                {
                    String           TweetText  = getTweetText();
                    Core.iTunesClass latestsong = Song.getLatestSong();
                    String           sendtext   = Core.Replace.ReplaceText(TweetText, latestsong);
                    stream.WriteString(sendtext);
                }
                pipeServer.Close();
                pipeServer.Dispose();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("[PluginSystem] ERROR");
                Debug.WriteLine(ex.ToString());
            }
            finally
            {
                if (pipeServer != null)
                {
                    if (pipeServer.IsConnected)
                    {
                        pipeServer.Dispose();
                    }
                }
            }
            //Remake thread
            StartThread();
        }
Пример #5
0
 //iTunesの曲変更イベント
 void iTunes_OnPlayerPlayEvent(object iTrack)
 {
     Core.iTunesClass song = new Core.iTunesClass(iTunes.CurrentTrack);
     //曲が変更された時だけイベントを取るから前回と比較する
     if (song.TrackDatabaseID != LastSong.TrackDatabaseID)
     {
         LastSong = song;
         OnPlayerPlayEvent(song);
     }
 }