Δημοσιεύτηκε: 15 Αύγ 2008, 13:21
από BlackSlash13
Πηγα διακοπες με τον φορητο και τον εξωτερικο σκληρο δισκο γεμάτο με divX συμπιεσμένες ταινίες που τις εχω αγοράσει νομιμα για να μην κουβαλάω τα αυθεντικα DVD που μπορει και να χαλάσουν στις διακοπές. Ο βλάκας όμως, στο encoding ξεχασα να ενσωματώσω τους υπότιτλους ....

Και μαντεψτε ; Ειχα 4 λειτουργικα πανω (λινουξ) και ειχα ξεχασει να βαλω ελληνικη υποστηριξη. Με αποτελεσμα τα αρχεια srt των υποτιτλων να μην εμφανιζονται (δεν ελεγε να δουλεξει το ατοιμο το encoding ) με αποτελεσμα να βλεπω μονο τελιες και ερωτηματικα. Ετσι, αφου δεν ειχα ιντερνετ επρεπε να βρω μια λυση. Η λυση ηταν να κατσω να γραψω ολο το αρχειο με τους υποτιτλους απο τα ελληνικα στα greeklish. Πολυ χρονοβορο ομως... Οποτε εφτιαξα ενα προγραμμα να το κανει αυτο αντι για μενα. Δεν ειναι τιποτα σπουδαιο απλα το παραθετω ως ιδεα. πχ βαζεις το αρχειο srt σε ενα φακελο μαζι με τον source, κανεις compile. Στην αρχη σου ζηταει ενα ονομα, οπου δινει το ονομα του αρχειο που εχεις στον φακελο μαζι με τον κωδικο, πχ SexAndTheCity.srt και στην συνεχεια δινεις ενα ονομα για το καινουριο αρχειο με τα greeklish πχ SexGreek.srt. και voila

Κώδικας: Επιλογή όλων
#include <fstream>
#include <iostream>
#include <string.h>
#include <cstdlib>
using namespace std;

int main()
{
    char phrasi[100];
    char Source[80], Target[80];
    cout << "Greek2Lish Converter (by BlackSlash)\n" << endl;
    cout << "Dose to onoma tou arxeiou iso-8859-7: ";
    cin >> Source;
    cout << "Dose to onoma  tou arxeiou Greeklish: ";
    cin >> Target;

    ifstream fin(Source);
    ofstream fout(Target);
    cout << "Convertion started . . .";
    char ch;
    while( fin.get(ch) )
    {
   if(int(ch) == -31 || int(ch) == -36 ) {
      fout << "a";
   } else if( int(ch) == -63 || int(ch) == -74) {
      fout << "A";
   } else if ( int(ch) == -30) {
      fout << "b";
   } else if ( int(ch) == -62 ) {
      fout << "B";
   } else if ( int(ch) == -61 ) {
      fout << "G";
   } else if ( int(ch) == -29 ) {
      fout << "g";
   } else if ( int(ch) == -28 ) {
      fout << "d";
   } else if ( int(ch) == -60 ) {
      fout << "D";
   } else if ( int(ch) == -27 || int(ch) == -35 ) {
      fout << "e";
   } else if ( int(ch) == -59 || int(ch) == -72 ) {
      fout << "E";
   } else if ( int(ch) == -26 ) {
      fout << "z";
   } else if ( int(ch) == -58 ) {
      fout << "Z";
   } else if ( int(ch) == -25 || int(ch) == -34 || int(ch) == -23 || int(ch) == -33) {
      fout << "i";
   } else if ( int(ch) == -57 || int(ch) == -71 || int(ch) == -55 || int(ch) == -70) {
      fout << "I";
   } else if ( int(ch) == -24 || int(ch) == -56 ) {
      fout << "th";
   } else if ( int(ch) == -22 ) {
      fout << "k";
   } else if ( int(ch) == -54 ) {
      fout << "K";
   } else if ( int(ch) == -21 ) {
      fout << "l";
   } else if ( int(ch) == -53 ) {
      fout << "L";
   } else if ( int(ch) == -20 ) {
      fout << "m";
   } else if ( int(ch) == -52 ) {
      fout << "M";
   } else if ( int(ch) == -19 ) {
      fout << "n";
   } else if ( int(ch) == -51 ) {
      fout << "N";
   } else if ( int(ch) == -18 ) {
      fout << "ks";
   } else if ( int(ch) == -50 ) {
      fout << "Ks";
   } else if ( int(ch) == -17 || int(ch) == -4 ) {
      fout << "o";
   } else if ( int(ch) == -49 || int(ch) == -68 ) {
      fout << "O";
   } else if ( int(ch) == -16 ) {
      fout << "p";
   } else if ( int(ch) == -48 ) {
      fout << "P";
   } else if ( int(ch) == -15 ) {
      fout << "r";
   } else if ( int(ch) == -47 ) {
      fout << "R";
   } else if ( int(ch) == -13 || int(ch) == -14 ) {
      fout << "s";
   } else if ( int(ch) == -45 ) {
      fout << "S";
   } else if ( int(ch) == -12 ) {
      fout << "t";
   } else if ( int(ch) == -44 ) {
      fout << "T";
   } else if ( int(ch) == -11 || int(ch) == -3 ) {
      fout << "u";
   } else if ( int(ch) ==  -43 || int(ch) == -66 ) {
      fout << "Y";
   } else if ( int(ch) == -10 ) {
      fout << "f";
   } else if ( int(ch) == -42 ) {
      fout << "F";
   } else if ( int(ch) == -9 ) {
      fout << "x";
   } else if ( int(ch) == -41 ) {
      fout << "X";
   } else if ( int(ch) == -8 ) {
      fout << "ps";
   } else if ( int(ch) == -40 ) {
      fout << "Ps";
   } else if ( int(ch) == -7 || int(ch) == -2 ) {
      fout << "o";
   } else if ( int(ch) == -39 || int(ch) == -65 ) {
      fout << "O";
   } else {
      fout << ch;
   }
   
    }
    cout <<"Job done.***\n";
   fin.close();
    return 0;
}