Create MediaWiki and RTF links to specific time points of audio and video files of your iTunes library

Nowadays you can find from iTunes university and other sources a vast number of recorded lectures from the best universities of the world. Sometimes it would be helpful to have the ability to refer to specific points of them as you can do when you read a PDF file and you use DEVONthink. From now on there is an AppleScript for that!

I wrote two versions of this AppleScipt with a slightly different functionality. The first creates a link to a custom time point, which you set manually after executing it. One or more files should be selected in your iTunes library before executing it.

The AppleScript code for creating MediaWiki links is the following:

The AppleScript code for creating RTF links is the following:

 

The second version creates a link to the current track that plays in iTunes to the current time point.

The AppleScript code for creating MediaWiki links is the following:

The AppleScript code for creating RTF links is the following:

Again the code for the links is sent to the clipboard and you may paste it to a MediaWiki page or a RTF document. Afterwards, every time you click a link an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving) or have the same effect by executing the AppleScript of this post.

 

20
Dec 2011
COMMENTS No Comments

Create MediaWiki and RTF links to audio and video files of your iTunes library

I use iTunes in order to organize and play my media files. I have written the following AppleScripts in order to have the ability to create direct links to these files. These links are quite persistent because they are not depended on the path of each file.

You should have selected one or more media files in your iTunes library before executing the scripts. The code for the links is sent to the clipboard and you may paste it to a MediaWiki page or a RTF document. Afterwards, every time you click a link an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving) or have the same effect by executing the AppleScript of this post.

The AppleScript code for creating MediaWiki links is the following:

The AppleScript code for creating RTF links is the following:

19
Dec 2011
COMMENTS No Comments

Automated creation of references with hyperlinks from Skim

In the post “Automated creation of a LaTeX compatible citation only from Skim! (with hyperlink included)” there is an AppleScript which creates a LaTeX reference in TextMate for the PDF file that you currently read in Skim. Now I will present an expanded and improved version of that AppleScript. Specifically the new AppleScript takes advantage of all my standardized notes in the first page of a PDF document.These notes can be created automatically from the AppleScript in the post “How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document“. Moreover you can find more information about these notes in my posts “How to put DevonThink links in Skim notes” and “Latin page numbers, Arabic page numbers and the fifth Skim note“.The references and hyperlinks that can be created from my new AppleScript are the following and correspond to the notes one through four:

1. A LaTeX reference to the exact PDF page which can be inserted in a MediaWiki page without any modifications or problems. Moreover, the necessary code for the creation of MediaWiki link is also included. An example is the following:

 (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: [x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2 27])

A prerequisite for the use of this reference is to have installed and properly customized the Wiki2LaTeX MediaWiki extension. I will write more about this and its importance in a future post.

2. A LaTeX reference that can be inserted in a text file together with the proper LaTeX code for the creation of the corresponding hyperlink. An example is the following:

(\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: \href{x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2}{27})

3. A MediaWIki internal link to the wiki page of the source, followed by an external link to the PDF file itself. An example is the following:

([[Deconstructing the Laws of Logic - Clark]]: [x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2 27])

4. A DEVONthink url

How to use this AppleScript
You should run the AppleScript when you read a PDF file in Skim and you want to make a reference to the current page. Additionally, a TextMate file should be opened. After the execution you can select from a menu which kind of reference you would like to be created. All the necessary numbers for the hyperlinks and the references are automatically created with the help of the fifth note. You can see this AppleScript in action in the following video:

The AppleScript code is the following:

 

How to use DevonThink links in a MediaWiki page

MediaWiki supports out of the box a number of protocols for external linking such as HTTP, HTTPS, mailto, IRC. Additionally it gives you the possibility to add your own protocols by modifing the LocalSettings.php file under the root folder.I have installed MAMP in order to use MediaWiki and lets say that my wiki is named “MyWiki”. Then the path for this file in my file structure is (I use Snow Leopard):

/Applications/MAMP/htdocs/MyWiki/LocalSettings.php

So in order for MediaWiki to be able to understand DevonThinklinks you need to add the following line to the LocalSettings.php file:


$wgUrlProtocols[] = 'x-devonthink-item://';

Then when you write in the edit mode of a MediaWiki page:

you just see

a nice hyperlink after saving.

Now MediaWiki and DevonThink are perfectly integrated! See a short demonstration in the following video.

If you want to learn how the wiki text in the above video can be created automatically using Skim, AppleScript and Textmate read the following posts: