INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Track info to text file  (Read 1446 times)

psychohistory

  • Member
  • *
  • Posts: 2
Track info to text file
« on: May 02, 2011, 11:26:52 pm »

Howdy!

I would like to simply output the current track title, album, artist, bitrate, bit depth, and sampling rate to a .txt file automatically.  I've been told a similar plugin exists, but it does not provide the bitrate/depth/sampling rate.

I'm very new to programming, so any help would be appreciated.  Even just a pseudocode, so I could fill in would be extremely helpful.  Thanks!

Logged

psychohistory

  • Member
  • *
  • Posts: 2
Re: Track info to text file
« Reply #1 on: June 07, 2011, 07:51:43 am »

Update!  I have code that writes to a text file ONCE.  I want it to overwrite at every track change.  HOW DO I USE EVENTS?   :-[

Code: [Select]
using System;
using System.Windows.Forms;
//css_reference MediaCenter.dll;

class Script : MarshalByRefObject
{
    public void Init(MediaCenter.MCAutomation mediaCenterInterface)
    {       
        MediaCenter.IMJCurPlaylistAutomation playlist = mediaCenterInterface.GetCurPlaylist ( );
        int pos = playlist.Position; 
        MediaCenter.IMJFileAutomation track = playlist.GetFile(pos);
       
        string artist = track.Artist;
        string album = track.Album;
        string name = track.Name;
        string bitrate = track.Bitrate.ToString();
        string filetype = track.Filetype;
                                           
        string[] lines = {artist,album,name,bitrate,filetype};
        System.IO.File.WriteAllLines(@"C:\Users\Jared\Desktop\testing.txt", lines);                                   
    }
}
Logged
Pages: [1]   Go Up