rubyecm2cue 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rubyecm2cue/rubyecm2cue.c +55 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20666a54dc4d62c54b05d28ec543c49159b9bd0c
4
- data.tar.gz: 3b35d5a0ec35f031569406ca11f5d991d58c2db2
3
+ metadata.gz: eb02bcf378557202142922ce52c9e67fa4b22f51
4
+ data.tar.gz: 69835ec78a4db990c4e4018c855ca84d236b058c
5
5
  SHA512:
6
- metadata.gz: 31c76014875eb91b9ea750c8ef48124505323b168ae50fc859f0c0c59d09f0367d085257cf3dd65363491d500707a12b17e66022a284fc8dccfefc9855aa2141
7
- data.tar.gz: ac20e8365812dfa88c125a810f3b9669fdf74bc187a97ca61da7c999c25d42eef12068fb9475653f1b39d50178a13de3fa84dbc315094959e0c1bd6e99faf7de
6
+ metadata.gz: 685b9e1264509097f1c45d43e4725050e6eb12534ba78505f5fe857e54f77a51021fbe1421bdc13f5f43a560202c68072114e7a1e8b87fdfa90b249aad3a8b7c
7
+ data.tar.gz: 7f6bddba21c966217e09533f6c20f1cf8dd27d875c523d9b04de6fb45240f6a4c32bb8c2eb3fe9398576be8e92a979d7344d4e8a0b009399b40a0c4b833cbb1c
@@ -12,8 +12,61 @@ void Init_rubyecm2cue(){
12
12
  }
13
13
 
14
14
  VALUE method_process(VALUE self, VALUE arg_path) {
15
- const char *img= StringValueCStr(arg_path);
16
- const char *retValue;
15
+ char *retValue = "";
16
+ char *infilename = StringValueCStr(arg_path);;
17
+ char *outfilename;
18
+ char *oldfilename;
19
+ int unecm_ret = 0;
20
+
21
+ FILE *fin, *fout, *cue_file;
22
+
23
+ eccedc_init();
24
+
25
+ if(strlen(infilename) < 5) {
26
+ strcpy(retValue, "filename is too short");
27
+ }
28
+ if(strcasecmp(infilename + strlen(infilename) - 4, ".ecm")) {
29
+ strcpy(retValue, "filename must end in .ecm");
30
+ }
31
+
32
+ outfilename = malloc(strlen(infilename) - 3);
33
+ oldfilename = malloc(strlen(infilename) - 3);
34
+ if(!outfilename) abort();
35
+ memcpy(outfilename, infilename, strlen(infilename) - 4);
36
+ outfilename[strlen(infilename) - 4] = 0;
37
+
38
+ fprintf(stderr, "Decoding %s to %s.\n", infilename, outfilename);
39
+
40
+ fin = fopen(infilename, "rb");
41
+ if(!fin) {
42
+ strcpy(retValue, "Cannot open file");
43
+ }
44
+ fout = fopen(outfilename, "wb");
45
+ if(!fout) {
46
+ strcpy(retValue, "Cannot write file");
47
+ fclose(fin);
48
+ }
49
+
50
+ unecm_ret = unecmify(fin, fout);
51
+
52
+ fclose(fout);
53
+ fclose(fin);
54
+
55
+ if(unecm_ret != 0) {
56
+ strcpy(retValue, "Cannot decode file");
57
+ }
58
+
59
+ strcpy(oldfilename, outfilename);
60
+ cue_file = fopen(strcat(outfilename, ".cue"), "w");
61
+ if(!cue_file) {
62
+ strcpy(retValue, "Cannot write cue file");
63
+ }
64
+ fprintf(cue_file, "FILE \"%s\" BINARY\n", oldfilename);
65
+ fprintf(cue_file, "\tTRACK 01 MODE1/2352\n");
66
+ fprintf(cue_file, "\t\tINDEX 01 00:00:00");
67
+ fclose(cue_file);
68
+
69
+ strcpy(retValue, outfilename);
17
70
 
18
71
  return rb_str_new_cstr(retValue);
19
72
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyecm2cue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferdinand E. Silva
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: ''
13
+ description: Ruby Extension In C To Decode ECM File And Generate Cue File
14
14
  email: ferdinandsilva@ferdinandsilva.com
15
15
  executables: []
16
16
  extensions:
@@ -43,5 +43,5 @@ rubyforge_project:
43
43
  rubygems_version: 2.4.3
44
44
  signing_key:
45
45
  specification_version: 4
46
- summary: ''
46
+ summary: Ruby Extension In C To Decode ECM File And Generate Cue File
47
47
  test_files: []