rg3/youtube-dl — pull request #351 by andreabravetti (2012-05-28 12:08:26+00:00)
Title: do not overwrite existing files

youtube-dl overwrite existing files and keep only one file per extension even if more than one exists.

Example:

[andrea@sibilla ~]$ youtube-dl --all-formats http://www.youtube.com/watch?v=00000000000

[youtube] Setting language
[youtube] 00000000000: Downloading video webpage
[youtube] 00000000000: Downloading video info webpage
[youtube] 00000000000: Extracting video information
[download] Destination: 00000000000.webm
[download] 100.0% of 3.71M at 779.58k/s ETA 00:00
[download] Destination: 00000000000.flv
[download] 100.0% of 3.03M at 257.87k/s ETA 00:00
[download] Destination: 00000000000.webm
[download] 100.0% of 2.80M at 771.26k/s ETA 00:00
[download] Destination: 00000000000.flv
[download] 100.0% of 2.68M at 222.57k/s ETA 00:00
[download] Destination: 00000000000.mp4
[download] 100.0% of 2.24M at 743.58k/s ETA 00:00
[download] Destination: 00000000000.flv
[download] 100.0% of 1.92M at 162.52k/s ETA 00:00

[andrea@sibilla ~]$ ls -l

-rw-rw-r--. 1 andrea andrea 3173446 16 set 2011 00000000000.flv
-rw-rw-r--. 1 andrea andrea 2347362 16 set 2011 00000000000.mp4
-rw-rw-r--. 1 andrea andrea 3886456 16 set 2011 00000000000.webm

It should be:

[andrea@sibilla ~]$ youtube-dl --all-formats http://www.youtube.com/watch?v=00000000000

[youtube] Setting language
[youtube] 00000000000: Downloading video webpage
[youtube] 00000000000: Downloading video info webpage
[youtube] 00000000000: Extracting video information
[download] Destination: 00000000000.webm
[download] 100.0% of 3.71M at 779.58k/s ETA 00:00
[download] Destination: 00000000000.flv
[download] 100.0% of 3.03M at 257.87k/s ETA 00:00
[download] Destination: 00000000000-1.webm
[download] 100.0% of 2.80M at 771.26k/s ETA 00:00
[download] Destination: 00000000000-1.flv
[download] 100.0% of 2.68M at 222.57k/s ETA 00:00
[download] Destination: 00000000000.mp4
[download] 100.0% of 2.24M at 743.58k/s ETA 00:00
[download] Destination: 00000000000-2.flv
[download] 100.0% of 1.92M at 162.52k/s ETA 00:00

[andrea@sibilla ~]$ ls -l

-rw-rw-r--. 1 andrea andrea 2807035 16 set 2011 00000000000-1.flv
-rw-rw-r--. 1 andrea andrea 2939698 16 set 2011 00000000000-1.webm
-rw-rw-r--. 1 andrea andrea 2008777 16 set 2011 00000000000-2.flv
-rw-rw-r--. 1 andrea andrea 3173446 16 set 2011 00000000000.flv
-rw-rw-r--. 1 andrea andrea 2347362 16 set 2011 00000000000.mp4
-rw-rw-r--. 1 andrea andrea 3886456 16 set 2011 00000000000.webm