Русские имена файлов в архиве
9 years 4 months ago - 9 years 4 months ago #21
by Vii
Vii replied the topic: Русские имена файлов в архиве
К стати, чтоб не исполь кучу мелких архивов и русскими именами файлов я решил распоковать и потом использовать для сжатия squashfs
Может тебе пригодится:
Разархивируем:
find [путь где хранится твоя библиотека] -name '*.zip' -exec sh -c 'cd "`dirname \"{}\"`"; unzip "{}"' ';'
Удаляем все зип архивы
find [путь где хранится твоя библиотека] -name '*.zip' -delete # если будут файлы с русскими именами в UTF-8 то будет глюк дальше
Устанавливаем утилиту для изменения кодировки имен файлов:
yum install convmv -y
Тут конечно топорно и не оптимизированно но это на один раз
find [путь где хранится твоя библиотека] -type d | awk '{system("cd \""$0"\"; convmv -f cp1252 -t cp850 *.fb2 --notest; convmv -f cp866 -t utf8 *.fb2 --notest")}'
Ну и сакмо переименование
find /films/sdc/000/test -type d | awk '{system("cd \""$0"\"; convmv -f cp1252 -t cp850 *.fb2 --notest; convmv -f cp866 -t utf8 *.fb2 --notest")}'
Ну и архивируем дальше с помощью squashfs
mydebianblog.blogspot.ru/2006/08/squashfs.html
Может тебе пригодится:
Разархивируем:
find [путь где хранится твоя библиотека] -name '*.zip' -exec sh -c 'cd "`dirname \"{}\"`"; unzip "{}"' ';'
Удаляем все зип архивы
find [путь где хранится твоя библиотека] -name '*.zip' -delete # если будут файлы с русскими именами в UTF-8 то будет глюк дальше
Устанавливаем утилиту для изменения кодировки имен файлов:
yum install convmv -y
Тут конечно топорно и не оптимизированно но это на один раз

find [путь где хранится твоя библиотека] -type d | awk '{system("cd \""$0"\"; convmv -f cp1252 -t cp850 *.fb2 --notest; convmv -f cp866 -t utf8 *.fb2 --notest")}'
Ну и сакмо переименование
find /films/sdc/000/test -type d | awk '{system("cd \""$0"\"; convmv -f cp1252 -t cp850 *.fb2 --notest; convmv -f cp866 -t utf8 *.fb2 --notest")}'
Ну и архивируем дальше с помощью squashfs
mydebianblog.blogspot.ru/2006/08/squashfs.html
Last Edit: 9 years 4 months ago by Vii.
Please Войти or Create an account to join the conversation.
- Vii
-
Topic Author
- Offline
- Новый участник
-
Less
More
- Posts: 16
9 years 4 months ago #22
by Vii
Vii replied the topic: Русские имена файлов в архиве
День добрый.
При создании БД в таблицах genres и bgenres была не та кодировка
#mysql -v
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 117
Server version: 5.1.71 Source distribution
# uname -a
Linux xxx.xxx.xx 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Вышел из положения добавив в фаил genres.sql:
use sopds;
>SET NAMES 'utf8';
>SET CHARACTER SET utf8;
drop table if exists genres;
При создании БД в таблицах genres и bgenres была не та кодировка
#mysql -v
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 117
Server version: 5.1.71 Source distribution
# uname -a
Linux xxx.xxx.xx 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Вышел из положения добавив в фаил genres.sql:
use sopds;
>SET NAMES 'utf8';
>SET CHARACTER SET utf8;
drop table if exists genres;
Please Войти or Create an account to join the conversation.
- Vii
-
Topic Author
- Offline
- Новый участник
-
Less
More
- Posts: 16
9 years 4 months ago #23
by mitshel
mitshel replied the topic: Русские имена файлов в архиве
Спасибо... Добавлю в скрипт.
Please Войти or Create an account to join the conversation.
- mitshel
-
- Offline
- Администратор
-
Less
More
- Posts: 297
- Karma: 8
9 years 4 months ago - 9 years 4 months ago #24
by Vii
Vii replied the topic: Русские имена файлов в архиве
Еще по безопастности (мои думки):
добавил файлы .htaccess с содержанием: deny from all в директории:
./db
./conf
./py/__pycache__
Добавил фаил .htaccess с содержимым:
<Files *.py>.
deny from all
</Files>
в директорию: ./py
Ну и конфиг апача, доступ к каталогу осуществляется http://[Ваш домен]/opds/:
<VirtualHost *:80>
DocumentRoot [Полный путь к директории с сайтом]
ServerName [Ваш домен]
ServerAlias www.[Ваш домен]
AddDefaultCharset UTF-8
DirectoryIndex index.html
Options Indexes FollowSymLinks
Alias /opds [Полный путь к директории с сайтом]/py
<Directory [Полный путь к директории с сайтом]/py >
AddHandler cgi-script .cgi
Options ExecCGI Indexes Multiviews FollowSymLinks
DirectoryIndex sopds.cgi
</Directory>
<Location /py>
Order Deny,Allow
Deny from all
</Location>
<Directory [Полный путь к директории с сайтом]>
AllowOverride All
XBitHack on
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Ну и в главном файле .htaccess закоментил:
#DirectoryIndex index.xml
#Options ExecCGI
добавил файлы .htaccess с содержанием: deny from all в директории:
./db
./conf
./py/__pycache__
Добавил фаил .htaccess с содержимым:
<Files *.py>.
deny from all
</Files>
в директорию: ./py
Ну и конфиг апача, доступ к каталогу осуществляется http://[Ваш домен]/opds/:
<VirtualHost *:80>
DocumentRoot [Полный путь к директории с сайтом]
ServerName [Ваш домен]
ServerAlias www.[Ваш домен]
AddDefaultCharset UTF-8
DirectoryIndex index.html
Options Indexes FollowSymLinks
Alias /opds [Полный путь к директории с сайтом]/py
<Directory [Полный путь к директории с сайтом]/py >
AddHandler cgi-script .cgi
Options ExecCGI Indexes Multiviews FollowSymLinks
DirectoryIndex sopds.cgi
</Directory>
<Location /py>
Order Deny,Allow
Deny from all
</Location>
<Directory [Полный путь к директории с сайтом]>
AllowOverride All
XBitHack on
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Ну и в главном файле .htaccess закоментил:
#DirectoryIndex index.xml
#Options ExecCGI
Last Edit: 9 years 4 months ago by Vii.
Please Войти or Create an account to join the conversation.
- Vii
-
Topic Author
- Offline
- Новый участник
-
Less
More
- Posts: 16
9 years 4 months ago #25
by Vii
Vii replied the topic: Русские имена файлов в архиве
Очень жду Аннотацию... Тестю в подарок покупаю планшет, один из пораметров - библиотека...
Please Войти or Create an account to join the conversation.
- Vii
-
Topic Author
- Offline
- Новый участник
-
Less
More
- Posts: 16
9 years 4 months ago #26
by mitshel
mitshel replied the topic: Русские имена файлов в архиве
Думаю к выходным будет.
Please Войти or Create an account to join the conversation.
- mitshel
-
- Offline
- Администратор
-
Less
More
- Posts: 297
- Karma: 8
Time to create page: 0.103 seconds