44328

itunes listening to

within windows live messenger, it is possible to share the song you are currently listening to. what would i need to do to get this working within c# like libarys etc cannot find the correct documentation on google.

Answer1:

You'll need to use the iTunes SDK to interact with iTunes from .NET. So there's your Google search term. :)

Here's a start:

    <li>http://blogs.msdn.com/b/noahc/archive/2006/07/06/automating-itunes-with-c-in-net.aspx</li> <li>http://blogs.msdn.com/b/dancre/archive/2004/05/08/128645.aspx</li> </ul>

    Answer2:

    last i checked this functionality is included out of the box all you need is to have itunes and windows live messenger installed and activate "what im listening to" and it shows this in your messenger status. if you are looking to create a bot that messages this out to a contact that is a different story tho that you will need to write a script for

    Answer3:

    Here is a script for LinqPad in C# which does as requested. (see LinqPad.com)

    Bonus! Artwork view.

    It looks like this:

    <img src="https://i.stack.imgur.com/Wd1SM.jpg" alt="example">

    <Query Kind="Program"> <Namespace>iTunesLib</Namespace> <Namespace>System.Security.Cryptography</Namespace> </Query> void Main() { var track = new iTunesApp().CurrentTrack; if (track == null) "nothing playing".Dump(); else new Viewer(track,true).Dump(); } public class Viewer { const string PREFIX = "itlps-"; private IITFileOrCDTrack store; private bool materialize; public string album { get { return store.Album; } } public string band { get { return store.Artist; } } public string song { get { return store.Name; } } public string desc { get { return store.Description; } } public int? artCnt { get { if (store.Artwork == null) return null; else return store.Artwork.Count; } } public IEnumerable<ImageViewer> art { get { if (materialize) { foreach(var artT in store.Artwork) { var art = artT as IITArtwork; string ext = ".tmp"; switch(art.Format) { case ITArtworkFormat.ITArtworkFormatBMP: ext = ".BMP"; break; case ITArtworkFormat.ITArtworkFormatJPEG: ext = ".JPG"; break; case ITArtworkFormat.ITArtworkFormatPNG: ext = ".PNG"; break; } string path = Path.Combine(Path.GetTempPath(),PREFIX+Path.GetRandomFileName()+ext); art.SaveArtworkToFile(path); yield return new ImageViewer(path); } } yield break; } } public Viewer(IITFileOrCDTrack t,bool materializeArt = false) { store = t; materialize = materializeArt; } public Viewer(IITTrack t,bool materializeArt = false) { store = t as IITFileOrCDTrack; materialize = materializeArt; } } public class ImageViewer { public string hash { get { return _hash.Value; } } static private string _path { get; set; } public object image { get { return _image.Value; } } static private SHA1Managed sha = new SHA1Managed(); private Lazy<object> _image = new Lazy<object>(() => {return Util.Image(_path);}); private Lazy<string> _hash = new Lazy<string>(() => { string hash = string.Empty; using (FileStream stream = File.OpenRead(_path)) { byte [] checksum = sha.ComputeHash(stream); hash = BitConverter.ToString(checksum).Replace("-", string.Empty); } return hash; }); public ImageViewer(string path) { _path = path; } }

Recommend

  • How do I create different layouts for 4“ and 10” displays at same resolution?
  • How do Responder Chain Works in IPhone? What are the “next responders”?
  • WPF - How could I get a scrollviewer control from my XAML file in C#?
  • TextBox not editing after SelectAll in vb.net
  • count(): Parameter must be an array or an object that implements Countable
  • How to I get this LINQ full-outer-join to function properly?
  • C# Stream Response from 3rd party, minimal buffering
  • Center Nav Bar when window resized?
  • Trusting X-Forwarded-For to “identify” a visitor
  • What is the best way to draw a large number of lines using openGL and cocos2D?
  • How can I properly import the environment from running a subcommand in Perl?
  • Stream data into rotating log tables in BigQuery
  • Get .NET Process object to flush input stream continously?
  • Find generic sub-lists within a list
  • Why are Google search results in UIWebView not triggering webViewDidFinishLoad?
  • How to run linqpad 2.x and 4.x side by side?
  • How do I install these PHP extensions on Ubuntu?
  • Installing SSL cert on Amazon EC2 ELB
  • Upload file that is in the cpan database
  • Sort List of Strings By Version
  • DomPDF {PAGE_NUM} not on first page
  • Email format validation in mvc3 view
  • Javascript simulate pressing enter in input box
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • How to add date and time under each post in guestbook in google app engine
  • Controls, properties, events and timers running in design time
  • Updated Ionic CLI but shows previous version (Windows)
  • Importing jscolor library in angular 2
  • Cannot Parse HTML Data Using Android / JSOUP
  • A cron job substitute?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • coudnt use logback because of log4j
  • Getting Messege Twice Using IMvxMessenger
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How to load view controller without button in storyboard?