Δημοσιεύτηκε: 18 Σεπ 2008, 19:17
από Cruster
Το θέμα είναι πολύ ενδιαφέρον μιας και υπάρχει πολύ συχνά πρόβλημα με την κωδικοποίηση των υποτίτλων. Εγώ έφτιαξα ένα nautilus-script (μόνο για gnome) που μετατρέπει την κωδικοποίησή τους.

Κώδικας: Επιλογή όλων
#!/bin/bash
#
# Copyright (C) 2008 Panagiotis Koutsias (panoskoutsias_at_hotmail_com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Name: Convert Encoding
# Type: Nautilus Script
#
# Dependency : iconv
# : zenity
#
# To install it just copy this file in your ~/.gnome2/nautilus-scripts folder
#
# Use: Select the files you want to convert their encodings in nautilus,
# right click on one of them and from the context menu "Scripts" choose Convert Encoding
#
# ToDo: Identify files into folders
#


#Option to handle files with spaces
IFS=$'\n'

#Get source & destination encoding
SRC_ENC=`zenity --entry --text="Enter the encoding of the selected file(s):"`
DST_ENC=`zenity --entry --text="Enter the encoding for the destination file(s):"`

#Convert all files
for FILE in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do

#Get file name
FILENAME=`basename $FILE`

#Convert specific file
iconv -f $SRC_ENC -t $DST_ENC $FILENAME -o $FILENAME.utf8

#Create backups
cp $FILENAME $FILENAME~
mv $FILENAME.utf8 $FILENAME

done


Η εγκατάσταση είναι απλή:

Εκτελείτε:
Κώδικας: Επιλογή όλων
gedit ~/.gnome2/nautilus-scripts/Convert\ Encoding

και κάνετε επικόλληση τον κώδικα από το παραπάνω μήνυμα και αποθηκεύετε.

Μετά εκτελείτε:
Κώδικας: Επιλογή όλων
chmod +x ~/.gnome2/nautilus-scripts/Convert\ Encoding

και με δεξί κλικ στο(α) αρχείο(α) που θέλετε να μετατρέψετε στο υπομενού Scripts διαλέγετε το Convert Encoding και απαντάτε στις ερωτήσεις που ζητάει.