2014. május 26.

Mplayer for music

I would like to have something like this:

1.) nautilus script
right click on file/dir to copy full path of file/dir
2.) text file
to paste the full paths of to be played items or dirs
3.) utility to handle the text file as a playlist

Description of the utility:
- uses mplayer to play audio/video files
- reads the first line of the text file, starts to play it, than deletes it so the second line becomes the new first line (alternately it moves the line to another text file's end, so the user can go backward in the playlist)
- user can edit the text file on-the-fly between tracks (edit playlist while playing)
- utility should be fool-proof (in case of wrong input it should pause and wait for user to correct error in playlist)


SD card failing...

I got these kind of errors with my microSD cards when I want to write on them. One is a 32GB SDHC the other is a 2GB SD.

in nautilus
Error creating file system: helper exited with exit code 1: Error calling fsync(2) on /dev/mmcblk0p1: Input/output error
with cp
cp: cannot create regular file `/media/Zene/test.mp3': Input/output error
with rsync
rsync: rename "/media/Zene/.test.mp3.FUG0AR" -> "test.mp3": Input/output error (5)
rsync: mkstemp "/media/Zene/.test.jpg.MMYg55" failed: Read-only file system (30)
sent 149488152 bytes  received 183 bytes  499126.33 bytes/sec
total size is 149469329  speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7]

and after this the drive was empty once again :-/

even in windows7, SD card dismounts after copy finished and almost everything disappears from the drive. SD slot did not come up on win7.

regarding the mp3 player I wanted to prep for usage with sd card, the files have to be loaded one after another to keep the order of the songs of the albums.
to copy sequentially use {rsync -v -r source/. for local folder/ dest} for directories.

~$ sudo fsck -v /dev/sdcard
can write out interesting information, but has been no help regarding this problem.

2014. május 21.

Mplayer music playback with playlist

the command to use:
$ mplayer -playlist playlist.txt 

to make a playlist:
1. go to the directory that contains the files you want to make a playlist of.
2.
$ find . -type f -name "*.mp3" | sort > directory_playlist.txt
3. edit txt file so it has the full path (not necessary)

to do the same with a one-line command (if you do not need to edit the playlist):
$ mplayer -playlist <(find /directory/of/your/music/ -name "*.mp3" -type f | sort)

hit enter for the next track
cit crtl+c to break playback

A couple of useful commands with or within mplayer:
-shuffle : shuffle playlist
-loop : play the playlist repeatedly (can be combined with -loop)

2014. április 8.

Google Tasks: what it can and cannot do

As you can see on this page, Tasks are accessible from Gmail, from Calendar and from Mobile, through a web browser.

For what I use it for...

Let's begin with the useful parts:

  • it is possible to turn an e-mail into a task
  • it is possible to drag and drop due tasks in the calendar
  • it is possible to make separate lists for separate fields of tasks
Now, there...
  • it is not possible to set due date for e-mail tasks with one click.
    • for me the best would be if whatever e-mail I turn into a task would turn due for today, because than I can drag and drop it in the calendar.
  • it is not possible to archive task items, it is only possible to delete them.
    • for this reason my tasks list is hundreds of items long.
  • it is not possible to multiple select tasks to move them around in your list or add due date to them
  • it is not possible to view different task lists simultaneously in calendar
    • therefor I do not use different lists
If you happen to know a solution to the functions I miss, please leave a comment to this post and tell me about it!

2014. március 16.

DJVU extract images

A useful link:
http://askubuntu.com/questions/46233/converting-djvu-to-pdf

Another useful link: http://unix.stackexchange.com/questions/20592/extract-several-pages-from-a-djvu-file
http://kheyali.blogspot.hu/2011/08/in-order-to-convert-djvu-file-into.html

And another: http://en.wikisource.org/wiki/Help:DjVu_files#DjVu_to_Images


Extract images from DJVU:
DDJVU
The easiest way to do this is probably by extracting to multipage tiff
Than split tiff file with tiffsplit: http://manpages.ubuntu.com/manpages/hardy/man1/tiffsplit.1.html
Than convert to anything useful.
Except that did not work for the file I had...

Okay, so the second way is the script way. Copy the script, paste it to an empty text file. Give it the extension .sh and give it permission to execute as program. Put it in a directory with all the djvu-s you want to extract and run in terminal.

#!/bin/bash
#Ubuntu 10.04 Lucid Lynx

#Put this script file in a directory with all the djvu-s you want to extract and run it in terminal.
#All the DJVU-s in this folder will be extracted to PNM-s.

### Select files to process
#defining the filelist
filelist=(`find -iname '*.djvu' | sort`)
#counting the files in the filelist
element_count=${#filelist[*]}
echo "alltogether $element_count djvu will be processed"

#process only 1 file at a time:
counter=1
echo "processing file:"
for i in "${filelist[@]}"
do
echo -ne "$element_count/$counter"\\r

#Get the number of pages from input file
pagecount=`djvused -e n $i`
#Set a filelist for the pages
 for (( filelist=1; filelist<=$pagecount; filelist+=1 ))
 do
 #Extract with DDJVU
 ddjvu -format=pnm -page=$filelist $i file_$counter.page_$filelist.pnm
 #Or use DjvuPs to extract PS from DJVU the same way:
 #djvups -page=$filelist $i file_$counter.page_$filelist.ps
 done
let "counter = $counter + 1"
done

echo DONE.

2014. február 19.

Modify PDF pages as images, than reintegrate

what just has happened?!

I successfully reintegrated a modified PDF in the original file!

wow! that is definitely a level up in image-pdf editing for me.

pdftk input.pdf cat 2 output page2.pdf
pdfinfo page2.pdf 
Page size: 595 x 842 pts (A4) pdfimages page2.pdf img
identify -verbose img-000.pbm
Geometry: 2496x3440+0+0 Resolution: 72x72 Page geometry: 2496x3440+0+0 Modified the image through Gimp. Open, Edit, Save -> Export -> click Ok whenever needed. convert img-000.pbm -resample 300x300 -resize 2496x3440 img2.ps
identify -verbose img2.ps
  Geometry: 599x826+0+0
  Resolution: 72x72
  Page geometry: 599x826+0+0

ps2pdf12 -sPAPERSIZE=a4 -dFIXEDRESOLUTION img2.ps page2_v2.pdf
pdfinfo page2test4pdf.pdf 
  Page size:      595 x 842 pts (A4)

pdftk A=input.pdf B=page2_V2.pdf cat A1 B A3-end output output.pdf

2014. február 12.

Crate a link file pointing to web URL

1. Create an empty text file.

2. Copy the following content in it:

[Desktop Entry]
Encoding=UTF-8
Name=Link to Ask Ubuntu
Type=Link
URL=http://www.askubuntu.com/
Icon=text-html

Edit Name and URL to desired name and url.

3. Save file
4. Close file
5. Rename file to have the extension ".desktop"

Done.