Added archive previews

pull/19/head
mananapr 6 years ago
parent e117bd0c2c
commit c204025c49

@ -14,6 +14,7 @@ minimal.
- `vim` for renaming, bulk renaming and editing clipboard - `vim` for renaming, bulk renaming and editing clipboard
- `mediainfo` for viewing media info and file sizes - `mediainfo` for viewing media info and file sizes
- `sed` for removing a particular selection - `sed` for removing a particular selection
- `atool` for archive previews
## Compiling and Installation ## Compiling and Installation
To compile, run To compile, run

19
cf.c

@ -556,6 +556,19 @@ void getVidPreview(char *filepath, int maxy, int maxx)
} }
/*
Gets previews of archives
*/
void getArchivePreview(char *filepath, int maxy, int maxx)
{
char buf[250];
sprintf(temp_dir,"atool -lq \"%s\" > ~/.cache/cfiles/preview",filepath);
system(temp_dir);
sprintf(temp_dir,"%s/preview",cache_path);
getTextPreview(temp_dir, maxy, maxx);
}
/* /*
Gets previews of video files (Dummy) Gets previews of video files (Dummy)
*/ */
@ -583,13 +596,15 @@ void getFileType(char *filepath)
void getPreview(char *filepath, int maxy, int maxx) void getPreview(char *filepath, int maxy, int maxx)
{ {
getFileType(filepath); getFileType(filepath);
if(strcasecmp("jpg",last) == 0 || strcasecmp("png",last) == 0 || strcasecmp("mp3",last) == 0) if(strcasecmp("jpg",last) == 0 || strcasecmp("png",last) == 0 || strcasecmp("gif",last) == 0 || strcasecmp("jpeg",last) == 0 || strcasecmp("mp3",last) == 0)
{ {
getImgPreview(filepath, maxy, maxx); getImgPreview(filepath, maxy, maxx);
clearFlag = 1; clearFlag = 1;
} }
else if(strcasecmp("mp4",last) == 0 || strcasecmp("mkv",last) == 0 || strcasecmp("avi",last) == 0) else if(strcasecmp("mp4",last) == 0 || strcasecmp("mkv",last) == 0 || strcasecmp("avi",last) == 0 || strcasecmp("webm",last) == 0)
getDummyVidPreview(filepath, maxy, maxx); getDummyVidPreview(filepath, maxy, maxx);
else if(strcasecmp("zip",last) == 0 || strcasecmp("rar",last) == 0 || strcasecmp("cbr",last) == 0 || strcasecmp("cbz",last) == 0)
getArchivePreview(filepath, maxy, maxx);
else else
getTextPreview(filepath, maxy, maxx); getTextPreview(filepath, maxy, maxx);
} }

Loading…
Cancel
Save